Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Fixed bug where drawer on mobile does not get dismissed after making a selection",
"packageName": "@internal/react-composites",
"email": "carolinecao@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@ export const MoreDrawer = (props: MoreDrawerProps): JSX.Element => {
// But this is a known issue in our state.
onSelectSpeaker(selected as AudioDeviceInfo);
}
props.onLightDismiss();
},
[speakers, onSelectSpeaker]
[speakers, onSelectSpeaker, props]
Copy link
Copy Markdown
Member

@JamesBurnside JamesBurnside Jul 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: avoid props as this means any prop change will cause this to be recreated.
Instead update the above const { speakers, onSelectSpeaker } = props;
to have the onLightDismiss:
const { speakers, onSelectSpeaker, onLightDismiss } = props;
and put onLightDismiss into the dependency array

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^^ I second this as well!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated :)

);

const drawerSelectionOptions = inferCallWithChatControlOptions(props.callControls);
Expand Down Expand Up @@ -142,8 +143,9 @@ export const MoreDrawer = (props: MoreDrawerProps): JSX.Element => {
// But this is a known issue in our state.
onSelectMicrophone(selected as AudioDeviceInfo);
}
props.onLightDismiss();
},
[microphones, onSelectMicrophone]
[microphones, onSelectMicrophone, props]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit: same here on avoiding props in the dep array)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^^ I second this as well

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated :)

);

if (props.microphones && props.microphones.length > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ test.describe('CallWithChat Composite CallWithChat Page Tests', () => {
await moreDrawerSpeakerDiv?.click();
const submenuNewAudioDeviceDiv = await page.$('div[role="menu"] >> text="Fake Audio Output 1"');
await submenuNewAudioDeviceDiv?.click();
//need to open again because submenu is dismissed automatically after selection
await pageClick(page, dataUiId('call-with-chat-composite-more-button'));
await moreDrawerSpeakerDiv?.click();
await page.$('div[role="menu"] >> text="Fake Audio Output 1"');
expect(await stableScreenshot(page)).toMatchSnapshot(`call-with-chat-more-drawer-submenu-speaker-select.png`);
}
});
Expand All @@ -177,7 +181,6 @@ test.describe('CallWithChat Composite CallWithChat Page Tests', () => {
await submenuNewAudioDeviceDiv?.click();

// Display MoreDrawer to view newly selected audio device
await page.mouse.click(100, 100);
await pageClick(page, dataUiId('call-with-chat-composite-more-button'));
expect(await stableScreenshot(page)).toMatchSnapshot(
`call-with-chat-more-drawer-new-selected-speaker-screen.png`
Expand All @@ -203,6 +206,11 @@ test.describe('CallWithChat Composite CallWithChat Page Tests', () => {
await moreDrawerMicrophoneDiv?.click();
const submenuNewAudioDeviceDiv = await page.$('div[role="menu"] >> text="Fake Audio Input 1"');
await submenuNewAudioDeviceDiv?.click();

//need to open again because submenu is dismissed automatically after selection
await pageClick(page, dataUiId('call-with-chat-composite-more-button'));
await moreDrawerMicrophoneDiv?.click();
await page.$('div[role="menu"] >> text="Fake Audio Input 1"');
expect(await stableScreenshot(page)).toMatchSnapshot(`call-with-chat-more-drawer-submenu-microphone-select.png`);
}
});
Expand All @@ -220,7 +228,6 @@ test.describe('CallWithChat Composite CallWithChat Page Tests', () => {
await submenuNewAudioDeviceDiv?.click();

// Display MoreDrawer to view newly selected audio device
await page.mouse.click(100, 100);
await pageClick(page, dataUiId('call-with-chat-composite-more-button'));
expect(await stableScreenshot(page)).toMatchSnapshot(
`call-with-chat-more-drawer-new-selected-microphone-screen.png`
Expand Down