Add generic forwarding of events and fix focus outlines #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #1
📑 Description
This PR adds general event delegation to the icons. Right now the library only forwards explicit events with
on:click
,on:keydown
, etc. event forwarders.svelte-preprocess-delegate-events
supports the general forwarding of events with a newon:*
directive. This PR adds that dependency according to its README instructions and converts the current forwarders to a generic forwarder that the proprocessor uses. Using this library also means Svelte won't set up inert event listeners by default, fixing the focus issue identified in #1.Svelte 5 should fix this so this would only be a temporary solution until it's released.
✅ Checks
ℹ Additional Information
This all seems to work in my testing. I've
npm run build && npm run preview
and tried adding click, focus, and blur listeners to the icons using in the/icons
route and they still work even after converting everything to use the preprocessor with theon:*
directive.There might be a better way to test installing the package as a dep. If you want I could do that and/or add some integration tests.
Also, here's the shell script I used to update the files:
Thank you!