Skip to content

Bring the Tailwind theme up to par with Bootstrap#1699

Open
neilvcarvalho wants to merge 3 commits into
json-editor:masterfrom
neilvcarvalho:nc/tailwind-fixes
Open

Bring the Tailwind theme up to par with Bootstrap#1699
neilvcarvalho wants to merge 3 commits into
json-editor:masterfrom
neilvcarvalho:nc/tailwind-fixes

Conversation

@neilvcarvalho

Copy link
Copy Markdown
Q A
Is bugfix? ✔️
New feature?
Is backward-compatible? ✔️
Tests pass? ✔️
Fixed issues #1612, #1698
Updated README/docs?
Added CHANGELOG entry? ✔️

The Tailwind theme was in need of some love on the accessibility front.

This Pull Request fixes two issues on that theme:

#1612 - Missing for attribute in labels

Based on the Bootstrap themes, we now add for and aria-describedby attributes to labels, ensuring that label clicks work, and screen readers have a correct mapping of labels and fields.

#1698 - Using style elements to hide fields

Also based on the Bootstrap themes, we now use Tailwind classes to hide elements instead of falling back to the default implementation (that modifies the style attribute).

When using the Tailwind theme, labels don't have a `for` attribute. This
makes the library less accessible and harder to use with automated test
libraries that rely on accessible names.

This commit adds `for` labels and `aria-describedby` attributes based on
how the Bootstrap themes do it, fixing this issue.
@neilvcarvalho

Copy link
Copy Markdown
Author

Hi @germanbisurgi, thanks for keeping this project alive!

Although this is not a critical bugfix, it addresses some pains of my current project's usage. We use Tailwind and noticed that some stuff that are on the Bootstrap themes are missing. Please let me know if there's anything I could do to make this PR move forward.

The Tailwind theme does not have the `getHiddenText`, `getHiddenLabel`
and `visuallyHidden` methods, falling back to the abstract theme
implementation. The Bootstrap themes, in contrast, implement those
methods using the Bootstrap classes.

Modifying the `style` attribute, as the abstract theme does, raises some
CSP issues that don't happen by applying a class instead.

This commit implements those methods using Tailwind classes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant