Skip to content

Make toolbar accessible #2

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

Merged
merged 5 commits into from
Jun 13, 2016
Merged

Make toolbar accessible #2

merged 5 commits into from
Jun 13, 2016

Conversation

MathuraMG
Copy link
Collaborator

Trello card

This PR:

  • changes the play and stop elements to buttons
  • makes the stop button always visible ( to increase accessibility)
  • adds title to the iframe

@catarak
Copy link
Member

catarak commented Jun 9, 2016

Now that the play/pause buttons are button elements, they have an outline when you click them which doesn't look great. Does adding outline: none affect tabbing in accessibility?

Also, for the css, I prefer to use BEM, as in the class for the buttons should be toolbar__stop-button--selected.

@catarak catarak closed this Jun 9, 2016
@catarak catarak reopened this Jun 9, 2016
@MathuraMG
Copy link
Collaborator Author

MathuraMG commented Jun 9, 2016

outline:none doesn't affect tabbing, I'll add that

I didn't entirely get the class naming, should toolbar__stop-button--selected be the initial state?

@catarak
Copy link
Member

catarak commented Jun 9, 2016

Yes exactly!

@MathuraMG
Copy link
Collaborator Author

MathuraMG commented Jun 9, 2016

I added BEM style to the buttons, however both styles look similar now.
What do you think of merging both to just .toolbar__button and .toolbar__button--selected ?

@catarak
Copy link
Member

catarak commented Jun 10, 2016

The BEM philosophy is for each HTML element to have one class (though I find myself breaking this more than occasionally), because CSS specificity rules get annoying fast and are hard to debug. I recommend reading about BEM to understand why it's used. There are lots of other CSS philosophies, like OOCSS, but for me, I find using BEM the easiest.

In the Toolbar component, the buttons should be either .toolbar__<type>-button--selected or .toolbar__<type>-button.

Then, to make all of this work with SCSS, what you can do is in the %toolbar-button placeholder in _placeholders.scss, change it to

%toolbar-button {
   //...existing styles...
  &--selected {
    background-color: $light-button-background-hover-color;
    & g {
        fill: $light-button-hover-color;
    }
  }
}

Then, in _toolbar.scss, the stop button would look like

.toolbar__stop-button {
    @extend %toolbar-button;
    &--selected {
        @extend %toolbar-button;
        @extend %toolbar-button--selected;
    }
}

@MathuraMG
Copy link
Collaborator Author

MathuraMG commented Jun 10, 2016

Thanks for the above, I'll make the changes !

I stand corrected on what I said about outline:none . I came came across a lot of articles that mention that it is quite important, especially on :focus ( for instance - article )
To take care of this, the simple solution would be to add the below in %toolbar-button

&:focus {
        outline: 1px solid #dddddd;
}

But I see how this throws off the aesthetics. As this works well with screen readers right now ( with outline:none; ), what do you think off making this a separate item for later so that we can also address the design?

Edit : All these articles seem pretty old - but this was one suggestion - paciellogroup

@catarak
Copy link
Member

catarak commented Jun 10, 2016

I'm okay with figuring out the outline stuff later! For this project I know that there is some design budget so we can just save it for when we need a bunch of design input.

@MathuraMG
Copy link
Collaborator Author

Great, I've added a card to look at this - trello card

@@ -10,23 +10,25 @@ class Toolbar extends React.Component {
render() {
let playButtonClass = classNames({
"toolbar__play-button": true,
Copy link
Member

Choose a reason for hiding this comment

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

this line should be
"toolbar__play-button": !this.props.isPlaying

@MathuraMG
Copy link
Collaborator Author

In the current code, the html works as follows.
when play is selected

<button class="toolbar__play-button toolbar__play-button--selected">
<button class="toolbar__stop-button">

when stop is selected

<button class="toolbar__play-button">
<button class="toolbar__stop-button  toolbar__stop-button--selected">

Based on my findings while reading up on BEM, the standard seems to be that the modifier class is added to the base class instead of replacing it.
BEM Naming

<div class="block block--mod">...</div>
    <div class="block block--size-big
        block--shadow-yes">...</div>

Additionally, it seems like replacing it has a few drawbacks.
link

That's why I have structured the code as is. Please let me know if I'm missing something and we should go for the single class approach.

@catarak
Copy link
Member

catarak commented Jun 13, 2016

Cool, my bad, let's leave it that way then. 😄

@catarak catarak merged commit 4539946 into processing:master Jun 13, 2016
@MathuraMG MathuraMG deleted the toolbar branch June 17, 2016 14:44
@cshirky cshirky mentioned this pull request Feb 21, 2018
2 tasks
catarak pushed a commit that referenced this pull request Mar 1, 2018
* Change accessibility example links

* added library to iframe

* changed preview to add accessible elements to iframe

* add library only when accesible output is seleceted

* focus on iframe when plaing

* css

* deleted accessibleOutput.jsx and edited IDEView to integrate accessibility library

* deleted comments

* fix package

* Moved CSS to library and removed section from file.js (#2)

* Remove gitmodule (#509)


* remove git modules

* removed submodule and replaced interceptor for library

* removed submodule and replaced interceptor for library (#510)

* deleted comments

* deleted jquery

* deleted interceptor folder

* delete interceptor

* added jquery

* removed jquery and updated accessible library cdn

* Fixes #508 (#539)

* removed submodule and replaced interceptor for library

* deleted comments

* deleted jquery

* deleted interceptor folder

* delete interceptor

* added jquery

* removed jquery and updated accessible library cdn

* remove empty divs from files.js

* fix merge error

* remove empty divs from files.js

* Fixes #508  (#545)

* removed submodule and replaced interceptor for library

* deleted comments

* deleted jquery

* deleted interceptor folder

* delete interceptor

* added jquery

* removed jquery and updated accessible library cdn

* remove empty divs from files.js

* fix merge error

* remove empty divs from files.js

* moved accessible output css

* removed css, added aria-label, preliminary cdn update

* removed section from iframe

* updated cdn

* add autofocus; remove CSS
andrewn pushed a commit to andrewn/p5.js-web-editor that referenced this pull request Aug 12, 2020
catarak pushed a commit that referenced this pull request Sep 4, 2020
catarak pushed a commit that referenced this pull request Nov 3, 2021
raclim pushed a commit that referenced this pull request Oct 19, 2022
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.

2 participants