Frontmatter
| title | Fix #4799 - form.field.Select Editable False Behavior |
| author | stokedowl |
| state | Closed |
| createdAt | Oct 4, 2023, 1:57 PM |
| updatedAt | Oct 12, 2023, 6:59 AM |
| closedAt | Oct 12, 2023, 6:59 AM |
| mergedAt | |
| branches | dev ← dev |
| url | https://github.com/neomjs/neo/pull/4971 |

hi @stokedowl, you did pick a pretty challenging ticket for getting started.
sadly, i can not accept the PR in the current state: we must not set readOnly to true for non-editable fields. while it does work, the problem is accessibility. setting this config will also apply readonly on DOM level:
https://github.com/neomjs/neo/blob/dev/src/form/field/Text.mjs#L649
then browsers (or even worse screen readers) think, that users are not supposed to fill out the related field at all.
so, we need to apply the same logic, just in a different way. e.g. we do get the css selector neo-not-editable (inside form.field.Picker):
https://github.com/neomjs/neo/blob/dev/resources/scss/src/form/field/Picker.scss
which currently already sets user-select: false. the problem here is that the field does not receive focus then, when clicking on the input node. as a result, focussing a different node will not trigger a focusLeave event and an open picker does not get hidden. solving it in a clean way is definitely non-trivial.
accessibility will become a huge topic for us starting in january => we want to add aria roles to each neo component and add keyboard navigation to more spots (e.g. toolbars & buttons).
in case more people want to contribute, we also need to get better in describing tickets & a roadmap. we can talk about it inside the workshop :)

Superseded by https://github.com/neomjs/neo/pull/5006
https://github.com/neomjs/neo/assets/24494104/7491568f-ee24-4664-87ae-a98f60cdb361
Summary:
This PR addresses the issue outlined in #4799 regarding the behavior of
form.field.Selectwheneditableis set tofalse. Previously, the picker wouldn't hide onFocusLeave() due to certain CSS rules (pointer-events: none; user-select: none;) applied to the input node, causing manager.Focus to be confused as the field wasn't receiving a click event.Changes:
shouldHideTriggermethod inText.mjsto returntrueto hide the trigger when the field is read-only.shouldHideTriggermethod inPicker.mjsto returnfalseto not hide the trigger for the Picker class.pointer-events: none; user-select: none;) that were causing the onFocusLeave event issue from.neo-pickerfield .neo-not-editable .neo-textfield-input.These changes result in a cleaner and expected behavior of the
form.field.Selectcomponent wheneditableis set tofalse, ensuring that the picker hides correctly on onFocusLeave without being affected by the specified CSS rules.Testing:
form.field.Selectcomponent behaves as expected wheneditableis set to bothtrueandfalse.What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
The PR fulfills these requirements:
devbranch, not themasterbranchfix #xxx[,#xxx], where "xxx" is the issue number)