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

TearsheetShell focus code exceptions and excessive focuses #3988

Closed
1 of 3 tasks
wkeese opened this issue Dec 27, 2023 · 0 comments · Fixed by #3989
Closed
1 of 3 tasks

TearsheetShell focus code exceptions and excessive focuses #3988

wkeese opened this issue Dec 27, 2023 · 0 comments · Fixed by #3989
Labels
component: Tearsheet type: bug 🐛 Something isn't working version: 2 Carbon 11 / v2

Comments

@wkeese
Copy link
Contributor

wkeese commented Dec 27, 2023

What package(s) are you using?

  • Carbon for IBM Products (or Carbon for IBM Cloud & Cognitive)
  • Legacy/CDAI
  • Legacy/Security

Detailed description

Describe in detail the issue you're having.

Every time I open a Tearsheet, every Tearsheet on the page tries to focus. This is because in handleStackChange.checkFocus(), position === depth === 0 for every tearsheet.

May be happening especially when using stacked tearsheets instead of nested tearsheets (see #2452).

To make matters worse, handleStackChange.claimFocus() may get an exception because there’s no element matching selectorPrimaryFocus. This happens for Tearsheets that defer rendering until they are opened:

<Tearsheet selectorPrimaryFocus="[role=tab]">
   { open && <TabList>}
</Tearsheet>

Is this issue related to a specific component?

Yes, Tearsheet

What did you expect to happen? What happened instead? What would you like to
see changed?

Lots of exceptions in the console.

What browser are you working in?

Chrome

What version of the @carbon/ibm-products (or @carbon/ibm-cloud-cognitive)
package are you using?

2.18.0

What offering/product do you work on? Any pressing ship or release dates we
should be aware of?

IKC (nee Waston Knowledge Catalog)

Steps to reproduce the issue

Should be able to see the behavior from https://carbon-for-ibm-products.netlify.app/?path=/story/ibm-products-components-tearsheet-tearsheet--stacked by setting a breakpoint in TearsheetShell.js. But the exception won't happen unless you have markup like above:

<Tearsheet selectorPrimaryFocus="[role=tab]">
   { open && <TabList>}
</Tearsheet>

Please create a reduced test case in CodeSandbox

https://codesandbox.io/s/github/carbon-design-system/ibm-products/tree/main/examples/carbon-for-ibm-products/SidePanel

@github-project-automation github-project-automation bot moved this to Needs triage 🧐 in Carbon for IBM Products Dec 27, 2023
wkeese added a commit to wkeese/carbon-ibm-products that referenced this issue Dec 27, 2023
wkeese added a commit to wkeese/carbon-ibm-products that referenced this issue Dec 27, 2023
@matthewgallo matthewgallo added type: bug 🐛 Something isn't working component: Tearsheet version: 2 Carbon 11 / v2 labels Jan 3, 2024
@elycheea elycheea moved this from Needs triage 🧐 to Community backlog 🚞 in Carbon for IBM Products Jan 4, 2024
@github-project-automation github-project-automation bot moved this from Community backlog 🚞 to Done 🚀 in Carbon for IBM Products Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: Tearsheet type: bug 🐛 Something isn't working version: 2 Carbon 11 / v2
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants