Need fix for "Dropdown automatically selects first option if another focusable item is pressed #11873" extended to keyboard selection.
Open
mattlking
opened this issue 5 years ago
•
4 comments
All of the necessary context is detailed in #11873. The difference here is that the original problem, while fixed for mouse clicks, still happens if you to a select item using the keyboard, i.e. tabbing to a (single-select) dropdown causes the first item in the list to be automatically selected and this selection is not removed once you tab on. Our app is reliant on a user being able to tab over irrelevant fields in a form, but they are always getting set to the first item and, once set, cannot be unset, even with a mouse!
@mattlking - thank you for reaching out to us and sharing the context into the issue you are facing.
@miroslavstastny - Could you confirm issue #11873 where it resolved the mouse clicks, but the issue still happens if you to a select item using the keyboard? Then confirm if this is a regression, or if this behavior is an issue? Thanks
cc @smhigley
Hi All, I lost sight of this one, which used to be a minor irritation, until it hit us again, and this time, it’s critical to the product functionality. Can you give me an update please? If unsure of the precise issue, let me explain it in the simplest terms I can... If I have a simple (or any flavour of) Fluent UI drop-down control, when I use the keyboard to tab to it, it always immediately selects the first option in its list and this remains selected once I tab or click away. So if I’m tabbing down drop-downs on a form, they all get selected without any other action, meaning that, with keyboard input alone (which is popular with some of our mouse hating users!), there is no way to step over a field without setting it. The reason this has now become critical for us is that one of our drop-downs is being programmatically set based on the value of a text input field. We are allowing overrides, but we certainly don’t want an override always to the first option just by tabbing to it (as it’s adjacent to the text field being used to control it). By the way, I’m having another issue with Fluent UI that is directly impacting this. To work-around the above problem, I wanted to change the tab order to skip the drop-down field. However, I cannot get tabIndex to work with Fluent controls. I get some weird effects but nothing even close to the behaviour I need (and nothing that changes the order). Actually, I’m not completely sure it’s even a Fluent UI issue as I just tried the following with plain JSX and it also had no impact on the ordering:
Can you see anything wrong with this? From what I’ve read, you only need to change “tabindex” to “tabIndex” to get it working under JSX (and this works in plain HTML). Many thanks,Matt From: GogomesSent: 07 June 2021 14:51To: microsoft/fluentuiCc: mattlking; MentionSubject: Re: [microsoft/fluentui] Need fix for "Dropdown automatically selects first option if another focusable item is pressed #11873" extended to keyboard selection. ***@***.*** - thank you for reaching out to us and sharing the context into the issue you are ***@***.*** - Could you confirm issue #11873 where it resolved the mouse clicks, but the issue still happens if you to a select item using the keyboard? Then confirm if this is a regression, or if this behavior is an issue? Thankscc @smhigley—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or unsubscribe.
Hi there, Trying again, although I have some new information and am really confused by it. The problem wherein the first option of a dropdown is selected as soon as the control receives focus (programmatically or using the key, but NOT by clicking into it) is just happening in my own development environment, wherein it is running on Node (from a command window under Windows 10). Once published, the problem does not occur. However, bizarrely, when my colleague runs it (identical codebase), also using Node (same version), he does not see it...and that is irrespective of browser type/version. The onChange event is giving me this: event:bubbles: falsecancelable: falsecurrentTarget: nulldefaultPrevented: falsedetail: 0dispatchConfig: {phasedRegistrationNames: {…}, dependencies: Array(1), eventPriority: 0}eventPhase: 1isDefaultPrevented: ƒ functionThatReturnsFalse()isPersistent: ƒ functionThatReturnsTrue()isPropagationStopped: ƒ functionThatReturnsFalse()isTrusted: truenativeEvent: FocusEvent {isTrusted: true, relatedTarget: input#AdmissionDate-label.ms-TextField-field.field-109, view: Window, detail: 0, sourceCapabilities: InputDeviceCapabilities, …}relatedTarget: input#AdmissionDate-label.ms-TextField-field.field-109target: div#LaboratoryId.ms-Dropdown.is-required.dropdown-341timeStamp: 528148type: "focus"view: Window {window: Window, self: Window, document: document, name: '', location: Location, …}_dispatchInstances: null_dispatchListeners: null_targetInst: FiberNode {tag: 5, key: null, elementType: 'div', type: 'div', stateNode: div#LaboratoryId.ms-Dropdown.is-required.dropdown-341, …}[[Prototype]]: Objectvalue:ParentKey: ""key: "1"text: "Default"[[Prototype]]: Object(the value being the first available option, which was NOT manually selected and was showing the placeholder before tabbing to it). Do you have any idea why this might be happening on my setup and not my colleagues (or in a published environment). As you can see, the option has already been selected before our code is called by yours, so I’m not sure what else to check. Regarding the TabIndex stuff, I have found that some of your controls (dropdowns for instance) support the passing of ‘tabIndex=-1’ and some just ignore it (e.g. icon buttons, panelbar). Is there a plan to make the support of tabIndex consistent across all controls? Thanks again,Matt From: Mathew KingSent: 07 October 2021 20:32To: microsoft/fluentui; microsoft/fluentuiCc: Mention; matt kingSubject: RE: [microsoft/fluentui] Need fix for "Dropdown automatically selects first option if another focusable item is pressed #11873" extended to keyboard selection. (#17944) Hi All, I lost sight of this one, which used to be a minor irritation, until it hit us again, and this time, it’s critical to the product functionality. Can you give me an update please? If unsure of the precise issue, let me explain it in the simplest terms I can... If I have a simple (or any flavour of) Fluent UI drop-down control, when I use the keyboard to tab to it, it always immediately selects the first option in its list and this remains selected once I tab or click away. So if I’m tabbing down drop-downs on a form, they all get selected without any other action, meaning that, with keyboard input alone (which is popular with some of our mouse hating users!), there is no way to step over a field without setting it. The reason this has now become critical for us is that one of our drop-downs is being programmatically set based on the value of a text input field. We are allowing overrides, but we certainly don’t want an override always to the first option just by tabbing to it (as it’s adjacent to the text field being used to control it). By the way, I’m having another issue with Fluent UI that is directly impacting this. To work-around the above problem, I wanted to change the tab order to skip the drop-down field. However, I cannot get tabIndex to work with Fluent controls. I get some weird effects but nothing even close to the behaviour I need (and nothing that changes the order). Actually, I’m not completely sure it’s even a Fluent UI issue as I just tried the following with plain JSX and it also had no impact on the ordering:
Can you see anything wrong with this? From what I’ve read, you only need to change “tabindex” to “tabIndex” to get it working under JSX (and this works in plain HTML). Many thanks,Matt From: GogomesSent: 07 June 2021 14:51To: microsoft/fluentuiCc: mattlking; MentionSubject: Re: [microsoft/fluentui] Need fix for "Dropdown automatically selects first option if another focusable item is pressed #11873" extended to keyboard selection. ***@***.*** - thank you for reaching out to us and sharing the context into the issue you are ***@***.*** - Could you confirm issue #11873 where it resolved the mouse clicks, but the issue still happens if you to a select item using the keyboard? Then confirm if this is a regression, or if this behavior is an issue? Thankscc @smhigley—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or unsubscribe.