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

fix: add aria-expanded to the toggler trigger #11052

Merged
merged 3 commits into from Mar 17, 2018
Merged

fix: add aria-expanded to the toggler trigger #11052

merged 3 commits into from Mar 17, 2018

Conversation

DanielRuf
Copy link
Contributor

@DanielRuf DanielRuf commented Mar 13, 2018

<a data-open="toggler">Open</a>
<a data-close="toggler">Close</a>
<a data-toggle="toggler">Toggle</a>
</div>`).appendTo('body');
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use a generator here to avoid code duplication ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, will prepare it then.

$('#toggler').should.have.attr('aria-expanded', 'true');
$triggers.find('[data-open]').should.have.attr('aria-expanded', 'true');
$triggers.find('[data-close]').should.have.attr('aria-expanded', 'true');
$triggers.find('[data-open]').should.have.attr('aria-expanded', 'true');
Copy link
Contributor

Choose a reason for hiding this comment

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

open, close, open. Should't it be toggle?

Also, Cannot we use ('[data-open], [data-close], [data-toggle]') here, or would this test for only the first element / one element and not every ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure here about toggler. Will check it then.

$('#toggler').should.have.attr('aria-expanded', 'true');
$triggers.find('[data-open]').should.have.attr('aria-expanded', 'true');
$triggers.find('[data-close]').should.have.attr('aria-expanded', 'true');
$triggers.find('[data-open]').should.have.attr('aria-expanded', 'true');
Copy link
Contributor

Choose a reason for hiding this comment

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

Unit tests. So let's tests only what the function should do alone and not all its side-effects. We tested that aria attribute are well set and updated above, no need to repeat it there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok.

$('#toggler').should.have.attr('aria-expanded', 'false');
$triggers.find('[data-open]').should.have.attr('aria-expanded', 'false');
$triggers.find('[data-close]').should.have.attr('aria-expanded', 'false');
$triggers.find('[data-open]').should.have.attr('aria-expanded', 'false');
Copy link
Contributor

Choose a reason for hiding this comment

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

Same

@DanielRuf
Copy link
Contributor Author

Pushed an update with the proposed changes.

Copy link
Contributor

@ncoden ncoden left a comment

Choose a reason for hiding this comment

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

👍 LGTM, thanks @DanielRuf !

@ncoden ncoden merged commit 571ba89 into foundation:develop Mar 17, 2018
@DanielRuf DanielRuf deleted the fix/toggler-aria-expanded-on-trigger-11049 branch March 17, 2018 22:23
ncoden pushed a commit to ncoden/foundation-sites that referenced this pull request Jun 16, 2018
…anded-on-trigger-11049 for v6.5.0

fbc69f1 fix: add aria-expanded to the toggler triggers
e84e7d1 fix: apply aria-expanded to the toggler triggers in _updateARIA
dd96a42 tests: replace duplicate code in the toggler test

Signed-off-by: Nicolas Coden <nicolas@ncoden.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants