Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide side_panel_button if empty #8492

Merged

Conversation

stevedya
Copy link
Contributor

@stevedya stevedya commented May 5, 2022

Addresses #8465. Using the empty: selector with css we are able to hide the button if there is nothing inside of it so that the empty element cannot be tabbed to.

  • Wrapped side_panel_button.html in spaceless to ensure there are no spaces inside the button when its empty and the empty: variant still works as expected
  • Added empty:w-hidden to hide the side panel button from screen readers when it is empty.
Wagtail.-.Editing.Blog.page_.Long.Blog.posting.-.5.May.2022.mp4

Tested on

Chrome 100, Safari 15.2, Firefox 99 (with browser-sync)

@squash-labs
Copy link

squash-labs bot commented May 5, 2022

Manage this branch in Squash

Test this branch here: https://stevedyachore8465-side-panel-i-mwkbc.squash.io

{% endif %}
</button>
{% spaceless %}
<button type="button" class="{{ classes }} w-bg-transparent w-text-14 w-p-0 w-text-teal-200 hover:w-text-teal-600 w-inline-flex w-justify-center w-transition empty:w-hidden" {% if data_url %}data-url="{{ data_url }}" {% endif %}{% if has_toggle %}data-button-with-dropdown-toggle {% endif %}{{ attr }}>{{ text }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can the {{ text }} be on a new line - makes it easier to read what is being done here, especially with the super long classes.

Suggested change
<button type="button" class="{{ classes }} w-bg-transparent w-text-14 w-p-0 w-text-teal-200 hover:w-text-teal-600 w-inline-flex w-justify-center w-transition empty:w-hidden" {% if data_url %}data-url="{{ data_url }}" {% endif %}{% if has_toggle %}data-button-with-dropdown-toggle {% endif %}{{ attr }}>{{ text }}
<button type="button" class="{{ classes }} w-bg-transparent w-text-14 w-p-0 w-text-teal-200 hover:w-text-teal-600 w-inline-flex w-justify-center w-transition empty:w-hidden" {% if data_url %}data-url="{{ data_url }}" {% endif %}{% if has_toggle %}data-button-with-dropdown-toggle {% endif %}{{ attr }}>
{{ text }}

@gasman gasman added this to the 3.0 milestone May 6, 2022
@thibaudcolas thibaudcolas force-pushed the chore/8465-side-panel-invisible-button branch from e846d30 to 28a168e Compare May 6, 2022 14:47
Copy link
Member

@thibaudcolas thibaudcolas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woo!

@thibaudcolas thibaudcolas merged commit cc74182 into wagtail:main May 6, 2022
thibaudcolas added a commit that referenced this pull request May 6, 2022
Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>
stevedya added a commit to stevedya/wagtail that referenced this pull request May 18, 2022
Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants