Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App switcher in UI Shell doesn't always close when clicking outside it #315

Closed
weaseldotro opened this issue Oct 8, 2020 · 8 comments · Fixed by #323
Closed

App switcher in UI Shell doesn't always close when clicking outside it #315

weaseldotro opened this issue Oct 8, 2020 · 8 comments · Fixed by #323
Labels
bug Something isn't working

Comments

@weaseldotro
Copy link
Contributor

Go to this demo: https://carbon-svelte.vercel.app/framed/UIShell/HeaderSwitcher
Open the app switcher in the UI Shell (top right button).
Click in the main window, anywhere between a few centimeters below the welcome text to the bottom of the page. So basically anywhere below <main>

This can be fixed by changing <svelte:body to <svelte:window in this line:
https://github.com/IBM/carbon-components-svelte/blob/master/src/UIShell/GlobalHeader/HeaderAction.svelte#L54

The app switcher is now closing, however I don't know if this has other consequences.

@metonym metonym added the bug Something isn't working label Oct 8, 2020
@metonym
Copy link
Collaborator

metonym commented Oct 8, 2020

Open to PRs

@weaseldotro
Copy link
Contributor Author

It seems that <svelte:body> is limited to the page body inside de browser window, while <svelte:window> uses the entire window. So if the page contents is smaller than the window, the rest of the window will not trigger the events defined on <svelte:body>

It looks like the same problem happens with the ComboBox component. So I did a search and the <svelte:body> is used in a bunch of components:

  • ComboBox/ComboBox.svelte
  • DatePicker/DatePicker.svelte
  • Dropdown/Dropdown.svelte
  • MultiSelect/MultiSelect.svelte
  • OverflowMenu/OverflowMenu.svelte
  • Slider/Slider.svelte
  • Tooltip/Tooltip.svelte
  • TooltipDefinition/TooltipDefinition.svelte
  • TooltipIcon/TooltipIcon.svelte

Most of them use the click event, TooltipDefinition and TooltipIcon use keydown, while Slider uses a few others.
Should I make a PR and replace all the instances of <svelte:body> with <svelte:window>?

@metonym
Copy link
Collaborator

metonym commented Oct 8, 2020

Start with the UI Shell header switcher

@phil-mayer
Copy link
Contributor

@metonym I can still see this behavior in MultiSelect/MultiSelect.svelte. The MultiSelect control does not close as expected if the body is shorter than the window and the user clicks an area between the bottom of the body and the bottom of the window.

Can I open a PR to switch out <svelte:body> for <svelte:window> on this component?

@metonym
Copy link
Collaborator

metonym commented Jul 22, 2021

@phil-mayer Yes

@weaseldotro
Copy link
Contributor Author

Might as well replace all the instances of <svelte:body> that I listed in my last message :)

@phil-mayer
Copy link
Contributor

Sure, happy to do so as long as @metonym is ok with the increase in scope.

@metonym
Copy link
Collaborator

metonym commented Jul 22, 2021

Yes, let's be consistent and resolve this once and for all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants