Page MenuHomePhabricator

MenuTagMultiselectWidget removes selected item when tabbing away
Closed, ResolvedPublicBUG REPORT

Description

MenuTagMultiselectWidget loses the first selected item when you tab away from the field.

Steps to reproduce:

  • Go to the OOUI demo page https://doc.wikimedia.org/oojs-ui/master/demos/
  • Scroll to MenuTagMultiselectWidget (initially selected, preset options)
  • Focus the field with the two pre-selected items
  • Tab away with (tab) or + (shift + tab)
  • The first selected item is deleted

Can also be experienced in production when using Advanced-Search while tabbing away from the namespace selection:

  • Go to e.g. https://de.wikipedia.org/wiki/Special:Search
  • Select multiple namespaces, e.g. simply click "All".
  • Now use the (tab) and + (shift + tab) keys to focus and leave the namespace input field multiple times.
  • Every time the input field looses focus, the first selected namespace is deleted.

Event Timeline

WMDE-Fisch renamed this task from Navigating AdvancedSearch form with tab key deletes selected namespaces to MenuTagMultiselectWidget removes selected item when tabbing away.Feb 1 2022, 12:14 PM
WMDE-Fisch added a project: OOUI.
WMDE-Fisch updated the task description. (Show Details)

I also found a similar issue that may or may not have the same root cause as the one reported here:

  • Go to the same demo mentioned in the task description and focus the field
  • Type something invalid, e.g. "foobar"
  • Click outside of the field, so that it loses focus
  • Focus the field again by clicking
  • Hit enter

This also results in the first card being removed, and whatever you typed will also disappear.

Change 891488 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[oojs/ui@master] Fix MenuSelectWidget removing unexpected items when tabbing out

https://gerrit.wikimedia.org/r/891488

Change 891493 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[oojs/ui@master] Improve documentation of .chooseItem() methods

https://gerrit.wikimedia.org/r/891493

Change 891493 merged by jenkins-bot:

[oojs/ui@master] docs: Improve documentation of `.chooseItem()` methods

https://gerrit.wikimedia.org/r/891493

I also found a similar issue that may or may not have the same root cause as the one reported here: [...]

This bug is not fixed by the patch above, so I'm assuming that the root cause is different, and I've filed a separate task for it: T330424.

Change 891488 merged by jenkins-bot:

[oojs/ui@master] Fix MenuSelectWidget removing unexpected items when tabbing out

https://gerrit.wikimedia.org/r/891488

Change 921070 had a related patch set uploaded (by VolkerE; author: VolkerE):

[mediawiki/core@master] Update OOUI to v0.47.0

https://gerrit.wikimedia.org/r/921070

Change 921070 merged by jenkins-bot:

[mediawiki/core@master] Update OOUI to v0.47.0

https://gerrit.wikimedia.org/r/921070