You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, we are still encountering the issue similar to one mentioned here: #3087 while working with FluentToolbar. Using the arrow keys -> changes the focus to components located to the left or right, depending on the arrow key pressed, instead of moving the cursor through text inside FluentSearch, FluentDatePicker, etc.
FluentUI version is 4.11.1
How to reproduce:
Simply wrap a couple of components that allow writing text or values with FluentToolbar:
changed the title [-]Hi, we are still encountering this **issue** while working with **FluentToolbar**. Using the **arrow keys** -> changes the **focus** to components located to the left or right, depending on the arrow key pressed, instead of **moving** the cursor **through text** inside FluentSearch, FluentDatePicker, etc.[/-][+]Issue with Toolbar and keyboard navigation[/+]on Jan 14, 2025
changed the title [-]Issue with Toolbar and keyboard navigation[/-][+]Arrow keys in-field navigation error having multiple components(Search, DatePicker, etc...) inside FluentToolbar[/+]on Jan 14, 2025
changed the title [-]Arrow keys in-field navigation error having multiple components(Search, DatePicker, etc...) inside FluentToolbar[/-][+]Issue with Toolbar and keyboard navigation[/+]on Jan 14, 2025
This sample provides expected behavior -- if needed as a workaround -- but only limited testing and not aware if it will cause issues elsewhere in the library such as accessibility.
Roland (@hml-coder) With which web components did you test? And how? (just curious)
For v4.12 we can look at integrating this script into the library. Only thing we would need to change probably is that the event listner would need to be added to the toolbar instead of to the document. If we add to document it will most probably be to greedy again
Vincent Baaij (@vnbaaij) Great question. I somehow missed that the web components test I ran wasn’t valid because the components weren’t inside a toolbar parent container, which is the root cause of the bug :-)
Completely agree on adding the script to the toolbar -- just wanted to share a simple example that can be verified in IssueTester.
Vincent Baaij (@vnbaaij) When I wrote that last post I was thinking that a fluent-toolbar web component did not exist but found that it does when I opened FluentToolbar.razor. I added the fluent-toolbar to my my test using web components 2.6.1 and this IS a web components issue.
I haven't reviewed the full history of this issue but based on the fluent-toolbar code, it intercepts keyboard events to initiate arrow key navigation. However, it does not prevent focus changes for input elements where focus should stay within the field.
public keydownHandler(e: KeyboardEvent): boolean | void {
const key = e.key;
if (!(key in ArrowKeys) || e.defaultPrevented || e.shiftKey) {
return true;
}
const incrementer = this.getDirectionalIncrementer(key);
if (!incrementer) {
return !(e.target as HTMLElement).closest("[role=radiogroup]");
}
const nextIndex = this.activeIndex + incrementer;
if (this.focusableElements[nextIndex]) {
e.preventDefault();
}
this.setFocusedElement(nextIndex);
return true;
}
Activity
[-]Hi, we are still encountering this **issue** while working with **FluentToolbar**. Using the **arrow keys** -> changes the **focus** to components located to the left or right, depending on the arrow key pressed, instead of **moving** the cursor **through text** inside FluentSearch, FluentDatePicker, etc.[/-][+]Issue with Toolbar and keyboard navigation[/+][-]Issue with Toolbar and keyboard navigation[/-][+]Arrow keys in-field navigation error having multiple components(Search, DatePicker, etc...) inside FluentToolbar[/+][-]Arrow keys in-field navigation error having multiple components(Search, DatePicker, etc...) inside FluentToolbar[/-][+]Issue with Toolbar and keyboard navigation[/+]hml-coder commentedon Jan 14, 2025
Issue does not occur with the
web components.This sample provides expected behavior -- if needed as a workaround -- but only limited testing and not aware if it will cause issues elsewhere in the library such as accessibility.
vnbaaij commentedon Jan 14, 2025
Roland (@hml-coder) With which web components did you test? And how? (just curious)
For v4.12 we can look at integrating this script into the library. Only thing we would need to change probably is that the event listner would need to be added to the toolbar instead of to the document. If we add to document it will most probably be to greedy again
hml-coder commentedon Jan 14, 2025
Vincent Baaij (@vnbaaij) Great question. I somehow missed that the web components test I ran wasn’t valid because the components weren’t inside a toolbar parent container, which is the root cause of the bug :-)
Completely agree on adding the script to the toolbar -- just wanted to share a simple example that can be verified in
IssueTester.hml-coder commentedon Jan 14, 2025
Vincent Baaij (@vnbaaij) When I wrote that last post I was thinking that a
fluent-toolbarweb component did not exist but found that it does when I openedFluentToolbar.razor. I added the fluent-toolbar to my my test usingweb components 2.6.1and this IS a web components issue.hml-coder commentedon Jan 14, 2025
I haven't reviewed the full history of this issue but based on the
fluent-toolbarcode, it interceptskeyboard eventsto initiate arrow key navigation. However, it does not prevent focus changes for input elements where focus should stay within the field.vnbaaij commentedon Jan 17, 2025
Roland (@hml-coder) (@chmod-600) Think you can wrap this up in a fix that we can deploy in an upcoming release?