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

fix(focus): fix focus order in post-megadropdown component #4379

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

alionazherdetska
Copy link
Contributor

No description provided.

@alionazherdetska alionazherdetska requested a review from a team as a code owner January 3, 2025 19:49
@alionazherdetska alionazherdetska linked an issue Jan 3, 2025 that may be closed by this pull request
Copy link

changeset-bot bot commented Jan 3, 2025

🦋 Changeset detected

Latest commit: 72a583f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 16 packages
Name Type
@swisspost/design-system-components Patch
@swisspost/design-system-components-angular-workspace Patch
@swisspost/design-system-components-react Patch
@swisspost/design-system-documentation Patch
@swisspost/design-system-components-angular Patch
@swisspost/design-system-nextjs-integration Patch
@swisspost/design-system-styles Patch
@swisspost/design-system-tokens Patch
@swisspost/design-system-intranet-header Patch
@swisspost/design-system-icons Patch
@swisspost/design-system-migrations Patch
@swisspost/design-system-styles-primeng Patch
@swisspost/internet-header Patch
@swisspost/design-system-intranet-header-workspace Patch
@swisspost/design-system-styles-primeng-workspace Patch
@swisspost/design-system-intranet-header-showcase Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@swisspost-bot
Copy link
Contributor

swisspost-bot commented Jan 3, 2025

Related Previews

Copy link

sonarqubecloud bot commented Jan 3, 2025

@@ -88,6 +95,14 @@ export class PostMegadropdown {
}
}

private getPostListItems(): HTMLElement[] {
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be that the first focusable element of the mega dropdown is not the first post-list-item but the post-list title as it could be a link as well.

Comment on lines +100 to +102
const focusableChildren = postListItems.flatMap(el => Array.from(getFocusableChildren(el)));

return focusableChildren;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const focusableChildren = postListItems.flatMap(el => Array.from(getFocusableChildren(el)));
return focusableChildren;
return postListItems.flatMap(el => Array.from(getFocusableChildren(el)));

@@ -98,16 +113,16 @@ export class PostMegadropdown {
ref={el => (this.popoverRef = el)}
>
<div class="megadropdown" onFocusout={e => this.handleFocusout(e)}>
<slot name="megadropdown-title"></slot>
Copy link
Contributor

Choose a reason for hiding this comment

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

This works in desktop but not in mobile, as it puts the back button after the elements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Megadropdown focus order
3 participants