fix: make the container styleable and give it an accessible name - #55
Open
sidgaikwad wants to merge 1 commit into
Open
fix: make the container styleable and give it an accessible name#55sidgaikwad wants to merge 1 commit into
sidgaikwad wants to merge 1 commit into
Conversation
Three problems with the rendered container, all in the same two divs.
`flex: 1` was written after the style spread, so it always won:
`style={{ flex: 'none' }}` was silently discarded. Move it before the
spread so it is a default the consumer can override.
The outer wrapper was unreachable — `minHeight` was the only thing a
consumer could influence, so dropping the component into a non-flex
layout needed an extra wrapper and !important. Add `wrapperStyle`.
The container had an id and nothing else. The embed renders an unlabelled
`div.image-editor-root` inside with no landmark and no name of its own, so
the entire editing surface was anonymous to assistive tech. Add
`role="region"` with an `ariaLabel` prop defaulting to 'Image editor'.
|
@sidgaikwad is attempting to deploy a commit to the Unlayer Team on Vercel. A member of the Team first needs to authorize it. |
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.
Fixes #43. Three problems in the same two divs.
1.
stylecould not overrideflex(the actual bug)flex: 1was written after the spread, so it always won —style={{ flex: 'none' }}or{ flex: '0 0 600px' }was silently discarded. Moving it before the spread makes it a default the consumer can override, with zero effect on anyone who doesn't set it.2. The outer wrapper was unreachable
minHeightwas the only thing a consumer could influence on the outer div; itsflex: 1anddisplay: flexwere fixed. Dropping the component into a plain block container, a grid cell or a fixed-height panel needed an extra wrapper plus!important. NewwrapperStyleprop.3. No accessible name
I checked what the embed actually renders inside the container on the running demo:
{ "tag": "DIV", "cls": "image-editor-root", "role": null, "aria-label": null }No landmark, no name, no headings — only
svg[role=img]icons. So the entire editing surface was anonymous to assistive tech, and our container contributed nothing but anid.Added
role="region"with anariaLabelprop defaulting to'Image editor'.This one is default-on, so flag it if you'd rather it weren't. A labelled
regionis a landmark and will show up in screen-reader landmark lists for existing consumers. I went default-on because the measurement above shows there is otherwise no accessible name at all, andregionis the conservative choice —role="application"would have changed screen-reader interaction mode, which I did not want to impose on a third-party UI.Verification
lint,typecheck,buildcleanConflict note
The README props-table edit will conflict with #54, which adds a
scriptUrlrow to the same table. Trivial to resolve; happy to rebase whichever lands second.