feat(annotation): Add the ability to override pointerEvents on Annotations#1879
Open
TSIA-SN wants to merge 1 commit into
Open
feat(annotation): Add the ability to override pointerEvents on Annotations#1879TSIA-SN wants to merge 1 commit into
TSIA-SN wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
🚀 Enhancements
As discussed in #1433, it may be desirable to have pointer events enabled on Annotations. This PR exposes the
pointerEventsattribute of the underlying elements while leaving the default as "none" to maintain the current behavior.Note: I was not able to get the demo project to run locally, so this PR could probably use some testing code. However, I was able to take the built package and use it successfully in my personal project on an HTMLLabel as a smoke test.
Regarding
SVGPropsvsSVGAttributes(see packages/visx-annotation/src/components/Connector.tsx), I decided to useSVGAttributessince the pointerEvent attribute is set on a standard element as opposed to a custom element. Additionally, tracing the types through, SVGProps extends SVGAttributes, which is wherepointerEventsis defined, so it seemed like the better option.📝 Documentation
I'm guessing the docs are in a separate repo, but https://airbnb.io/visx/docs/annotation could be updated to reference the new props. I added JSLint comments to the new props so they will be visible to developers.