cc-archive / cccatalog-frontend

[PROJECT TRANSFERRED] CC Search is a search tool for CC-licensed and public domain content across the internet.
https://github.com/WordPress/openverse-frontend
MIT License
163 stars 196 forks source link

Modal Accessibility Issues #1052

Closed zackkrida closed 4 years ago

zackkrida commented 4 years ago

Our modal component and our "arrow popup" component (usage 1) and usage 2 have major accessibility issues and should be extracted into their own components. They should later be moved into vue-vocabulary as well.

This is a react component, but the rendered HTML is an excellent reference for what features an accessible modal should support: https://reach.tech/dialog/

I have actually implemented all of this on a previous open-source vue project, which could be a god reference: https://github.com/sdras/cssgridgenerator/pull/9

dos077 commented 4 years ago

Hmm, was going to implement this, but looking at the code, this is the touch/mobile portion of the search filter module. If it's moved to a different component, the search filters component will be separated into two files, will be confusing for future maintenance.

IMO there should be one div that's styled according to screen size and the accessibility fixes should apply to the unified element. The current breakpoints are defined with Bulma, I think I can just import the breakpoints in the scss and maintain consistency without resorting to hide/show toggle two otherwise identical divs.

zackkrida commented 4 years ago

@dos077 FYI a generic AppModal component has been created already: https://github.com/creativecommons/cccatalog-frontend/blob/develop/src/components/AppModal.vue

It has a default slot so any contents can be added inside.

Basically, that component needs the additional a11y controls mentioned above, and then <div class="modal"> here: https://github.com/creativecommons/cccatalog-frontend/blob/develop/src/components/Filters/SearchGridFilter.vue#L5-L25 would need to be replaced with <app-modal>. No need to create additional files for search filters.

Let me know if that makes sense and if not I can try to clarify further. Thanks for looking into this issue!

dos077 commented 4 years ago

Reusable component is a good idea, but I still think hiding and showing two identical elements is not as efficient as just one element with responsive CSS. Anyway, since the component is already here, I agree it should be utilized then, just a bit of elbow grease.

dos077 commented 4 years ago

Okay, ended up making a lot more changes than I planed... Going to list them here as well as the pull request so everyone should get a chance to see it:

A few more things I should point out about why so much changes:

  1. Originally the filter modal (fix position) is nested inside a search column that has sticky position property. This is will not render correctly.
  2. Bulma's applies { overflow-x: hidden; overflow-y: scroll } to most(all?)elements. This makes nesting sticky position element impossible, not that's easy to begin with.