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(tile): change expandable tile to button #5609

Merged
merged 16 commits into from
Mar 23, 2020
Merged

fix(tile): change expandable tile to button #5609

merged 16 commits into from
Mar 23, 2020

Conversation

abbeyhrt
Copy link
Contributor

Closes #5557

This PR adds a FF specific override for the border and focus it was supplying to the Chevron in ExpandableTile.

Testing / Reviewing

Go to the ExpandableTile example in Storybook on Firefox and make sure that the Chevron does not receive focus.

@abbeyhrt abbeyhrt requested a review from a team as a code owner March 12, 2020 15:32
@ghost ghost requested review from asudoh and dakahn March 12, 2020 15:32
@netlify
Copy link

netlify bot commented Mar 12, 2020

Deploy preview for carbon-elements ready!

Built with commit 27366a0

https://deploy-preview-5609--carbon-elements.netlify.com

@netlify
Copy link

netlify bot commented Mar 12, 2020

Deploy preview for carbon-components-react ready!

Built with commit 27366a0

https://deploy-preview-5609--carbon-components-react.netlify.com

@netlify
Copy link

netlify bot commented Mar 12, 2020

Deploy preview for carbon-elements ready!

Built with commit ac44e74

https://deploy-preview-5609--carbon-elements.netlify.com

@netlify
Copy link

netlify bot commented Mar 12, 2020

Deploy preview for carbon-components-react ready!

Built with commit ac44e74

https://deploy-preview-5609--carbon-components-react.netlify.com

@abbeyhrt
Copy link
Contributor Author

Since the chevron is a button, it is still receiving focus. Going to try and figure out a different pattern to address this problem since this isn't the right solution.

asudoh
asudoh previously approved these changes Mar 12, 2020
Copy link
Contributor

@asudoh asudoh 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 @abbeyhrt!

@asudoh asudoh dismissed their stale review March 12, 2020 22:52

Seems that this PR is still WIP.

@tw15egan
Copy link
Collaborator

tw15egan commented Mar 13, 2020

Wondering why we need the icon to be wrapped in a button anyways 🤔Since the expansion is always triggered by clicking the tile itself, it seems like it may be unnecessary markup. Wonder if we can just switch it to a div, and move the aria-expanded to the container div? Since that is what is receiving focus anyways. The SVG seems to be decorative.

{...other}
onClick={this.handleClick}
onKeyPress={this.handleKeyDown}
// onKeyPress={this.handleKeyDown}
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you mean to remove this line, or keep it? Or is this PR still WIP...?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is still a WIP but since I changed the outer div to a button, handleKeydown is no longer necessary since handleClick will be triggered for keydown events. Definitely meant to remove it completely though! Not just comment it out, my bad!

@abbeyhrt
Copy link
Contributor Author

@tw15egan agreed! I'm thinking of going that route! Unfortunately, it seems like screenreaders don't read the expanded state unless it's on button or a tag. I'm messing around with changing the outer div to a button to remedy this but there is a little weirdness there as well.

@@ -284,23 +284,20 @@ describe('Tile', () => {
expect(wrapper.state().expanded).toEqual(false);
});

it('displays the default tooltip for the button depending on state', () => {
fit('displays the default tooltip for the button depending on state', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you want to revert this line?

@asudoh asudoh requested a review from a team March 18, 2020 00:24
@asudoh asudoh requested review from aagonzales and removed request for a team March 18, 2020 00:24
@aagonzales
Copy link
Member

The chevron is not receiving focus but the tile also isn't getting the focus border either. Is that intended?

@abbeyhrt
Copy link
Contributor Author

@aagonzales definitely not intentional! Where are you seeing this? I wasn't able to reproduce it

@aagonzales
Copy link
Member

aagonzales commented Mar 18, 2020

oh that's weird I just checked it again and now its there. I swear I didn't see it earlier. Oh well seems to be correct now 😆

@@ -22861,6 +22861,14 @@ Tile styles
}
}

.#{$prefix}--tile--expandable {
width: inherit;
Copy link
Contributor

Choose a reason for hiding this comment

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

Honestly I think there is not many use cases for width: inherit. So may I ask what this is for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just wanted it to get the width that was already defined in bx--tile, but I see that doing width: 100% gets the same result so I'll change it to that!

Copy link
Contributor

@asudoh asudoh 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 @abbeyhrt!

@abbeyhrt abbeyhrt changed the title fix(tile): remove border on chevron for firefox fix(tile): change expandable tile to button Mar 20, 2020
@abbeyhrt abbeyhrt merged commit ed96fef into carbon-design-system:master Mar 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants