LearnNewsExamplesServices
Frontmatter
id5371
titlemain.addon.Navigator: navigateTargetChildListChange() => steals focus
stateClosed
labels
bug
assigneesExtAnimal
createdAtMar 22, 2024, 6:36 PM
updatedAtMar 27, 2024, 4:18 PM
githubUrlhttps://github.com/neomjs/neo/issues/5371
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtMar 27, 2024, 4:18 PM

main.addon.Navigator: navigateTargetChildListChange() => steals focus

Closed v8.1.0 bug
tobiu
tobiu commented on Mar 22, 2024, 6:36 PM

while it does make sense for a form.field.ComboBox, the current behavior causes serious problems.

    // This is called if mutations take place within the subject element.
    // We have to keep things in order if the list items change.
    navigateTargetChildListChange(mutations, data) {
        this.fixItemFocusability(data);

        // Active item gone.
        // Try to activate the item at the same index;
        if (data.activeItem && !data.subject.contains(data.activeItem)) {
            const allItems = data.subject.querySelectorAll(data.selector);

            allItems.length && this.navigateTo(allItems[Math.max(Math.min(data.activeIndex, allItems.length - 1), 0)], data);
        }
    }

inside the learning section we have a topics list on the left, and a page sections list on the right side.

  1. navigate to a topic page
  2. click any item inside the right list
  3. navigate to a different topic
  4. the right list gets new store data
  5. at this point, the right list steals the focus, to re-focus the last index

without doing a deep dive, my first impression is that a ComboBox should send a target focus node id. if this one has the focus, keep the current logic. if it does not have the focus, do not re-apply it.

thoughts? @maxrahder @mxmrtns

tobiu added the bug label on Mar 22, 2024, 6:36 PM
tobiu assigned to @ExtAnimal on Mar 22, 2024, 6:36 PM
tobiu referenced in commit b9df7e3 - "main.addon.Navigator: navigateTargetChildListChange() => steals focus #5371" on Mar 27, 2024, 4:17 PM
tobiu
tobiu Mar 27, 2024, 4:18 PM

@ExtAnimal: added the config keepFocusIndex inside list.Base with a default to false. ComboBox will pass true into its list instance.

if you have a better idea to fix it, please open a new ticket.

tobiu closed this issue on Mar 27, 2024, 4:18 PM