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

Prevent showing the dropdown menu when changing orientation of mobile devices #12858

Merged
merged 5 commits into from
May 27, 2024

Conversation

andreslucena
Copy link
Member

@andreslucena andreslucena commented May 17, 2024

🎩 What? Why?

This PR fixes multiple bugs with the dropdowns and mobile devices.

In pages with these dropdowns, when the devise changes orientation from landscape (horizontal) to landscape and the dropdown appears, there are two things that happen:

  • The menu is shown (it should not be shown, as the dropdown should be closed)
  • The dropdown doesn't work (i.e. you click on it and it doesn't do anything)

If you refresh, this makes the dropdown to work again.

This can also be reproduced in a desktop by resizing the window and seeing the dropdown appear.

Another related bug to this is that in mobile devices we see a FUOC (flash of unstyled content) while loading pages with these dropdowns.

This PR fixes all of these bugs in the dropdowns that I could found.

At the technical level, for the moment I'm leaving the buggy data-disabled-md attribute, as it's still being used in System dashboard. The markup is that bad there that I couldn't find an easy way of fixing this bug, so we can tackle that problem in another PR (and drop the unnecessary data-disabled-md attr)

I also fixed a mini bug in the "Filter and Search" button title for components, so it has the correct capitalization for English ("Filter and search")

Finally I had to adapt the Javascript code that kicks in the Dropdowns, as there was an accessibility problem: if you have an element with attr-hidden=true and this element has children that could be focused, then we have an a11y validation (AXE) to fail (aria-hidden-focus). I fixed it by disabling focus when the dropdown is hidden (and enabling it again once it is open).

📌 Related Issues

Testing

  1. Go to each of these pages
  2. Change orientation in a mobile device or resize the width resolution in your webdev tools (or browser) to the dropdown kicks in
  3. (Before) see that you have the menu and you can't close it. Reload and see it fixed (but still see a FUOC)
  4. (After) see that the dropdown is closed and you don't see the menu. You can open the dropdown. Reloading it you don't see the FUOC.

Respecting the order of the files shown in GitHub to ease-up the review:

📷 Screenshots

Accountability results index

Accountability results index screenshot

Assembly admin page (or any admin page with a sidebar)

Assembly admin page (or any admin page with a sidebar) screenshot

Conferences show page

Conferences show page screenshot

Participatory process page (or any other participatory space)

Participatory process page (or any other participatory space)

Last activity page

Last activity page screenshot

Page in a topic

Page in a topic screenshot

Search page

Search page screenshot

Proposal index (or any other component)

Proposal index (or any other component) screenshot

My account page

My account page

♥️ Thank you!

github-actions[bot]
github-actions bot previously approved these changes May 17, 2024
github-actions[bot]
github-actions bot previously approved these changes May 17, 2024
@probot-autolabeler probot-autolabeler bot added the javascript Pull requests that update Javascript code label May 22, 2024
github-actions[bot]
github-actions bot previously approved these changes May 22, 2024
We need to disable focus in the children element of the hidden menu.
If not, we have an AXE error:

> aria-hidden-focus: ARIA hidden element must not be focusable or contain
focusable elements
Copy link
Contributor

@alecslupu alecslupu left a comment

Choose a reason for hiding this comment

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

👍

@andreslucena
Copy link
Member Author

Adding the no-backport label as this was introduced in v0.28 with the redesign and it was already backported to that version

@andreslucena andreslucena added the no-backport Pull Requests that should not be backported label Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
javascript Pull requests that update Javascript code module: accountability module: admin module: conferences module: core no-backport Pull Requests that should not be backported type: fix PRs that implement a fix for a bug
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Order projects by picker is not working on mobile
2 participants