dioxus icon indicating copy to clipboard operation
dioxus copied to clipboard

Add `relatedTarget` property to `FocusEvent`

Open Aaron3154518 opened this issue 1 year ago • 2 comments

Feature Request

I have a use case when I need to know what element is being focused when another element is being blurred. The stack overflow solution below uses the relatedTarget property to do this, however this property isn't exposed by dioxus. Can we get this field?

Stack overflow solution: https://stackoverflow.com/questions/39439115/how-to-execute-click-function-before-the-blur-function/57983847#57983847 relatedTarget: https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/relatedTarget

Aaron3154518 avatar Aug 18 '24 06:08 Aaron3154518

This could be added when the target field is added to events as a ElementRef (currently called MountedData).

ealmloff avatar Aug 19 '24 16:08 ealmloff

Is this being worked on? This is quite useful when figuring out e.g. whether to close a custom dropdown by checking which element is focused.

miguelpduarte avatar Dec 03 '24 12:12 miguelpduarte