Page MenuHomePhabricator

Examples button focused after selecting an example
Closed, ResolvedPublic

Description

An old and known annoyance, but apparently we didn’t have a ticket for it before: after selecting an example, the “Examples” button is focused, which means that pressing Ctrl+Enter not only runs the example query, but also reopens the examples dialog.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

After banging my head into this for a while…

It turns out that restoring the focus to the button that originally opened a modal is actually a feature of Bootstrap. And the way that Bootstrap does this (node_modules/bootstrap/js/modal.js, right at the end) is wrapped in so many event listeners that I can’t figure out a way for our own code to run after Bootstrap’s focus restorer, so there’s no good place for us to put some code that focuses the editor. A setTimeout will have to do.

Change 383882 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[wikidata/query/gui@master] Restore focus to editor after selecting example

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

Change 383882 merged by jenkins-bot:
[wikidata/query/gui@master] Restore focus to editor after selecting example

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