-
Notifications
You must be signed in to change notification settings - Fork 327
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
Add details script #610
Add details script #610
Conversation
Remove the script that creates an additional element for the details arrow and rely on CSS to create the arrow. IE8 doesn't know :: or currentColor so we fallback on : and inherit respectively.
a2a8a61
to
0bb8809
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looking really good – the tests are good but I think there are a number of code paths that aren't being tested right now, and it'd be good to cover them.
expect(summaryRole).toBe('button') | ||
}) | ||
|
||
it('should set the element controlled by the summary using aria-controls', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to have a test for a details element that already has an existing ID, to ensure the existing ID is used instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the id
attribute to the details component, but what we're generating via JavaScript and using in ARIA attributes are the <summary>
and <div>
container id
s; for which one can't pass any attributes at the moment - so a test won't be relevant in this cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha.
expect(summaryAriaExpanded).toBe('false') | ||
}) | ||
|
||
it('should add a unique id to the hidden content in order to be controlled by the summary', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to have a test for a details element that already has an existing ID, to ensure the existing ID is not overriden.
expect(hiddenContainerAriaHidden).toBe('true') | ||
}) | ||
|
||
it('should indicate the open state of the content', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to have a test for a details element that is open
when the page loads.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(That would also need a test that aria-hidden
is false)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
- the
open
attribute to the details component - an example where the details component is expanded by default
- the associated tests for the expanded/opened by default example
ad1c19a
to
47a469c
Compare
This PR:
details
element it is not natively supported by the browserManual tests
Browsers
IE8
IE9
IE10
IE11
Firefox 58 with custom colours
AT testing
Notes:
With
details.js
it announces collapsed button/expanded button.Without
details.js
:Notes:
With
details.js
on IE11/Firefox52 announces button collapsed/expanded.Notes:
With
details.js
on Firefox52/IE11 announces button collapsed/expanded.Automated tests
Trello card