Add "use div as legend" config and features value #803
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.
Let devs replace visible
legend
elems withdiv
. Follows accessibility guidelines by usingaria-labelledby
andid
.Devs can set "use div as legend" in the config file or the same key in the features block to a boolean. The feature block value takes precedence. This will change the visible HTML legend elements to divs. If the dev uses anything other than a boolean, they get an error message.
The motivation is Safari's (old and current) desktop versions and some user testing. Bootstrap says it supports current versions of Safari and that's correct - this isn't a direct Bootstrap problem. It's about the HTML is put together and which of Bootstrap's features are used there. With HTML that has a
legend
that uses Bootstrap's flexbox styles, Safari desktop handles thoselegend
nodes incorrectly. Thelegend
text is above the choices and right-aligned:User tests found that this visual was confusing. @VTskier might be able to speak about that.
This change fixes that issue with minimal side effects. Here is a decision matrix that I've shared.
Why allow both config and feature block keys? If a server has multiple organizations, as Suffolk's server does, different orgs might want to control their own settings.
Why change only visible legend elements? It is a smaller change and I thought it would be less trouble to review.
Why ensure always unique random ids? Devs should not rely on the selector. Avoids later breaking changes.
Manual tests
Outcomes of tests for configuration combinations:
Tests for error messages:
Relevant files
Edited:
Ignored:
div
andlegend
the same.legend
in checks for disabled fields. Bothdiv
andlegend
cannot be disabled and from what I saw in the code I believe jQuery would treat them the same way: https://github.com/jquery/jquery/blob/03e183c4ccf22bf4031920c3270c9f113cb72d1d/src/selector.js#L277 jQuery mentions the spec for disableable elements: https://github.com/jquery/jquery/blob/03e183c4ccf22bf4031920c3270c9f113cb72d1d/src/selector.js#L248-L250Compiled files (ignored):
I found no appearances of "disabled" associated with legends.