html icon indicating copy to clipboard operation
html copied to clipboard

focus delegate code seems wrongly only looking at children

Open emilio opened this issue 3 years ago • 2 comments

(Again, unless I'm missing something)

https://html.spec.whatwg.org/#focus-delegate says:

For each child of parent's children:

  1. Let focusable area be child, if child is a focusable area; otherwise let focusable area be the result of getting the focusable area for child given focus trigger.

It only looks at children, but it seems to (in a note) think that "getting the focusable area" can end up recursing. Which is true, but afaict it only does if the child has delegateFocus, which seems wrong (see #8156).

So I think this should look at all descendants in tree order, which combined with the fix for #8156 would give you the behavior we generally want / expect.

cc @sefeng211 @domenic

emilio avatar Aug 04 '22 06:08 emilio

So should we look for shadow root with delegateFocus and also non shadow host here?

sefeng211 avatar Aug 04 '22 22:08 sefeng211

Where exactly? "Get a focusable area" already deals with delegatesFocus so I think we don't need to do it twice.

emilio avatar Aug 05 '22 00:08 emilio