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

DataViews: Keyboard navigation in filter configuration listbox is broken #67152

Closed
jameskoster opened this issue Nov 20, 2024 · 6 comments · Fixed by #67212
Closed

DataViews: Keyboard navigation in filter configuration listbox is broken #67152

jameskoster opened this issue Nov 20, 2024 · 6 comments · Fixed by #67212
Assignees
Labels
[Feature] DataViews Work surrounding upgrading and evolving views in the site editor and beyond [Package] DataViews /packages/dataviews [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@jameskoster
Copy link
Contributor

jameskoster commented Nov 20, 2024

kb.mp4

When the listbox is focused, keyboard arrows up/down should navigate between options. This isn't currently the case. Curiously arrows left/right navigate instead.

To reproduce

  1. View DataViews component in Storybook
  2. Add a filter
  3. In the filter configuration popover move focus to the listbox of options
  4. Observe that arrow keys up/down do not navigate between options as expected
@jameskoster jameskoster added [Feature] DataViews Work surrounding upgrading and evolving views in the site editor and beyond [Package] DataViews /packages/dataviews [Type] Bug An existing feature does not function as intended labels Nov 20, 2024
@im3dabasia
Copy link
Contributor

Thanks, @jameskoster. I was able to reproduce the issue and will be raising a PR soon for this.

@t-hamano
Copy link
Contributor

Unfortunately, this issue appears to be new to WP6.7, so it might be worth fixing in a minor release.

cc @cbravobernal

@cbravobernal
Copy link
Contributor

I move it to 6.7.2, as we are right now closing editor tasks for 6.7.1 RC.

@Mayank-Tripathi32
Copy link
Contributor

I feel instead of adding custom logic for keyboard navigation, using the focusWrap prop seems to be a simpler way to enable up/down arrow navigation. However, I found that using the orientation prop to set the navigation to "vertical" doesn't seem to work. It might be worth looking into that.

I also found this to be working, but it doesn't feel like the best solution and might need improvement.
The following code: composite.item

onKeyDown={ ( event ) => {
    // Prevent left/right arrow keys, allow up/down for navigation
    if (
        event.key === 'ArrowLeft' ||
        event.key === 'ArrowRight'
    ) {
        event.preventDefault();
    }
} }

composite

<Composite
	virtualFocus
	focusLoop
	focusWrap
	orientation="vertical"
	aria-orientation="vertical"
       ...
/>

@t-hamano
Copy link
Contributor

Before we add new events or props, we need to investigate why this issue occurs.

From what I've researched, it seems like this issue first occurred in #65821.

@WordPress/gutenberg-components Do you know anything about this issue?

@mirka
Copy link
Member

mirka commented Nov 21, 2024

Found the bug 😝 #67212

Thanks @t-hamano for identifying the bad commit and nudging everyone to find the root cause first.

@cbravobernal cbravobernal moved this from 🔎 Needs Review to ✅ Done in WordPress 6.7.x Editor Tasks Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] DataViews Work surrounding upgrading and evolving views in the site editor and beyond [Package] DataViews /packages/dataviews [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
6 participants