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

STCOM-1238 Accordion vs overlay z-index issues. #2240

Merged
merged 5 commits into from
Mar 8, 2024
Merged

Conversation

JohnC-80
Copy link
Contributor

@JohnC-80 JohnC-80 commented Mar 8, 2024

Problem

Accordions with overlay components could have their overlays overlapped by other accordions due to z-index issues.

Approach

What we've previously done...
Accordions content would overlap overlays/dropdowns from previous accordions... (render with reverse z-index order to accordion index)
fixed, but..
Accordions content would overlap overlays/dropdowns from the following accordions...(have the focused accordion assume highest zindex from the set)
fixed, but
Accordions/overlays would go back to being overlapped if focus left the accordion or went to another pane...

In this PR, when focus moves to the accordion, it will find/assume the highest z-index among other accordions. It will retain this same z-index after it is blurred. If an accordion already has the highest z-index among accordions, it will not update its own. The z-indexes do continue to grow, but only for the life of a view... if navigation happens or accordions leave the DOM, all z-indices will be reset upon return.

accordionZResults

Copy link

github-actions bot commented Mar 8, 2024

Jest Unit Test Statistics

0 tests  ±0   0 ✔️ ±0   0s ⏱️ ±0s
0 suites ±0   0 💤 ±0 
0 files   ±0   0 ±0 

Results for commit 220004d. ± Comparison against base commit c5eab1d.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Mar 8, 2024

BigTest Unit Test Statistics

       1 files  ±0         1 suites  ±0   13s ⏱️ -1s
1 422 tests ±0  1 416 ✔️ ±0  6 💤 ±0  0 ±0 
1 425 runs  ±0  1 419 ✔️ ±0  6 💤 ±0  0 ±0 

Results for commit 220004d. ± Comparison against base commit c5eab1d.

♻️ This comment has been updated with latest results.

@JohnC-80 JohnC-80 requested review from BogdanDenis, zburke and a team March 8, 2024 16:21
Copy link
Member

@zburke zburke left a comment

Choose a reason for hiding this comment

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

Thanks for the detailed technical explanation in the PR description. I'd love to see a bit of that documentation/explanation filter down into comments directly on Accordion.js itself so the next person looking at the code can, in fact, just look at the code, without needing to dig up this PR to understand why we had to do things this way.

Comment on lines 125 to 126
// only update the accordion z-index if it does not contain focus or if it's not
// already the highest z-index among other accordions.
Copy link
Member

Choose a reason for hiding this comment

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

Pedantic: s/or/and/

Copy link

sonarcloud bot commented Mar 8, 2024

@JohnC-80 JohnC-80 merged commit 4e1820a into master Mar 8, 2024
6 checks passed
@JohnC-80 JohnC-80 deleted the STCOM-1238 branch March 8, 2024 21:21
github-actions bot pushed a commit that referenced this pull request Mar 8, 2024
* Accordions retain their z-index after being blurred, and assume the highest z-index when focus enters them.

* log changes

* remove unnecessary addition to z-index

* semi

* add comments to code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants