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

Arrow navigation no longer works in dropdown with input #36598

Closed
3 tasks done
RobiNN1 opened this issue Jun 18, 2022 · 10 comments
Closed
3 tasks done

Arrow navigation no longer works in dropdown with input #36598

RobiNN1 opened this issue Jun 18, 2022 · 10 comments

Comments

@RobiNN1
Copy link

RobiNN1 commented Jun 18, 2022

Prerequisites

Describe the issue

After upgrade to the current 5.2.0 beta-1 arrow navigation (up/down) no longer works in dropdown with input. And it doesn't produce any errors in console so Im not sure where the problem is since it worked fine in v5.1.3.

Reduced test cases

Open jsfiddle and click to input field, it opens dropdown menu with items but only in v5.1.3 you can navigate through items with up/down arrows.

BS 5.1.3 https://jsfiddle.net/2onqv40u/

BS 5.2.0 beta-1 https://jsfiddle.net/ot8nvqmL/

What operating system(s) are you seeing the problem on?

Windows

What browser(s) are you seeing the problem on?

Chrome

What version of Bootstrap are you using?

v5.2.0-beta-1

@jipexu
Copy link
Contributor

jipexu commented Jun 18, 2022

according to your 2 fiddles, same behavior here not work for (mac.... safari)

@SamuelMiller
Copy link

SamuelMiller commented Jun 18, 2022

The issue is specific to the bootstrap's new 5.2 javascript plugin.
The dropdown works as expected when 5.2 css beta is paired with 5.1 javascript, as in the following:

<head>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" crossorigin="anonymous">

<script defer src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
</head>

@julien-deramond
Copy link
Member

I'd say this issue comes from bb7664d.

@julien-deramond julien-deramond added this to To do in v5.2.0-stable via automation Jun 25, 2022
@julien-deramond julien-deramond moved this from To do to In progress in v5.2.0-stable Jun 25, 2022
@GeoSot GeoSot moved this from In progress to Review in progress in v5.2.0-stable Jun 27, 2022
@GeoSot
Copy link
Member

GeoSot commented Jun 27, 2022

Guys, may I ask a question here?

Is there any link, on BS documentation, that provides an example with this markup as valid, or we are just discussing for a side effect that some devs took advantage of?

/CC @patrickhlauke, do you think this is UX valid, to use this markup?

@julien-deramond
Copy link
Member

The use case seemed explicitly developed in the JS code but on my side, I haven't found this example in the BS documentation nor in the history of this component's JS modifications. I wasn't able to define if it was a side effect or really implemented voluntarily in BS.
If we consider that this use case (dropdown in combination with an input/textarea) is not valid, feel free to close the associated PR and this issue.

@RobiNN1
Copy link
Author

RobiNN1 commented Jun 27, 2022

It is not documented, but it should be. It's great feature for ajax search fields. Yes, it is possible to add own arrow navigation, but why not take advantage of that one in BS?

It works in BS 5.0.2 https://jsfiddle.net/az34jtew/ and in 4.6.1 as well https://jsfiddle.net/5a0Lofvs/

@patrickhlauke
Copy link
Member

From memory, the old behavior is an old remnant/side effect from an early version of Bootstrap (possibly before version 4?) that was never properly documented.

The only official documentation regarding cursor keys appeared back in version 4 https://getbootstrap.com/docs/4.6/components/dropdowns/#accessibility

However, Bootstrap does add built-in support for most standard keyboard menu interactions, such as the ability to move through individual .dropdown-item elements using the cursor keys and close the menu with the ESC key.

And I seem to remember the original code was quite hacky in terms of having to override normal keyboard behavior inside form fields that happen to be in a dropdown (e.g. things like textareas, where all of a sudden cursor keys didn't work as they should because of the override).

While I understand that having this undocumented feature helped create some interesting/creative approaches, like the ajax search above, note that those approaches are not fully "correct" from an accessibility point of view - you'd really want to implement them along these lines https://www.w3.org/WAI/ARIA/apg/patterns/combobox/

Even just for dropdowns with links, the current additional cursor navigation is "non-standard" really, but left there as a nice-to-have extra that doesn't interfere with regular accessibility of those dropdowns (which, in essence, are simply expand/collapse panels in the ARIA sense).

In short, I would suggest not reintroducing the old behavior and noting it as a change (but not a breaking change, since this was never an explicit/official feature of BS it seems).

@RobiNN1
Copy link
Author

RobiNN1 commented Jul 3, 2022

This was great undocumented feature but okay, I understand. I'll try to recreate arrow navigation with custom js.

@RobiNN1 RobiNN1 closed this as completed Jul 3, 2022
v5.2.0-stable automation moved this from Review in progress to Done Jul 3, 2022
@itsraghz
Copy link

itsraghz commented Sep 4, 2022

The issue is specific to the bootstrap's new 5.2 javascript plugin. The dropdown works as expected when 5.2 css beta is paired with 5.1 javascript, as in the following:

<head>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" crossorigin="anonymous">

<script defer src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
</head>

Perfect. This works as suggested. Hopefully this would be permanently fixed in Bootstrap 5.2 soon.

@RobiNN1
Copy link
Author

RobiNN1 commented Sep 4, 2022

Ehm @itsraghz it will never be fixed, read properly comments above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
v5.2.0-stable
  
Done
Status: Done
Development

Successfully merging a pull request may close this issue.

7 participants