Open ekashida opened 5 years ago
Possible solution: Dispatch focus
when needed, but need to investigate concerns around isTrusted
and whether relatedTarget
gets set correctly.
Also, don't forget about blur
.
@ekashida @gregwhitworth now that we are doing native shadow, this might be a good time to revisit this issue.
Another difference in native shadow and synthetic shadow was discovered around this.
Standard focus and blur events work differently. Consider a focusable element like:
<template>
<input type="text">
</template>
In synthetic shadow, focus and blur do not bubble up. E.g.:
<lightning-component
onfocus={iWillNotBeExecuted}
onblur={iWillNotBeExecuted}
></lightning-component>
In native shadow, blur and focus do bubble:
<lightning-component
onfocus={iWillBeExecutedIfInputisFocussed}
onblur={iWillBeExecutedIfInputIsBlurred}
></lightning-component>
(/ht to John Hefferman for this.)
Description
The host element should always receive the focus event whenever focus enters the shadow tree, regardless of the
delegatesFocus
ortabindex
value (needs spec verification).The current workaround is for the component to dispatch a focus event when it detects focus inside the shadow tree.
Steps to Reproduce
1242