Skip to content

Commit

Permalink
Merge branch 'master' into chore/add-review-label-workflow-and-action
Browse files Browse the repository at this point in the history
  • Loading branch information
joshblack authored Mar 23, 2020
2 parents e40a0d5 + 0ecd421 commit c63d94b
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 20 deletions.
13 changes: 13 additions & 0 deletions packages/components/docs/sass.md
Original file line number Diff line number Diff line change
Expand Up @@ -22808,6 +22808,11 @@ Tile styles
}
}

// Removes Firefox automatic border on buttons
.#{$prefix}--tile--expandable::-moz-focus-inner {
border: 0;
}

.#{$prefix}--tile--clickable {
@include reset;
@include type-style('body-short-01');
Expand Down Expand Up @@ -22864,6 +22869,14 @@ Tile styles
}
}

.#{$prefix}--tile--expandable {
width: 100%;
color: inherit;
font-size: inherit;
text-align: left;
border: 0;
}

.#{$prefix}--tile--expandable {
overflow: hidden;
transition: max-height $duration--moderate-01 motion(standard, productive);
Expand Down
13 changes: 13 additions & 0 deletions packages/components/src/components/tile/_tile.scss
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@
}
}

// Removes Firefox automatic border on buttons
.#{$prefix}--tile--expandable::-moz-focus-inner {
border: 0;
}

.#{$prefix}--tile--clickable {
@include reset;
@include type-style('body-short-01');
Expand Down Expand Up @@ -118,6 +123,14 @@
}
}

.#{$prefix}--tile--expandable {
width: 100%;
color: inherit;
font-size: inherit;
text-align: left;
border: 0;
}

.#{$prefix}--tile--expandable {
overflow: hidden;
transition: max-height $duration--moderate-01 motion(standard, productive);
Expand Down
15 changes: 5 additions & 10 deletions packages/react/src/components/Tile/Tile-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,17 +290,14 @@ describe('Tile', () => {

// Force the expanded tile to be collapsed.
wrapper.setState({ expanded: false });
const collapsedDescription = wrapper.find('button').getElements()[0]
.props['aria-label'];
const collapsedDescription = wrapper.find('button').prop('title');
expect(collapsedDescription).toEqual(defaultCollapsedIconText);

// click on the item to expand it.
wrapper.simulate('click');

// Validate the description change
const expandedDescription = wrapper.find('button').getElements()[0].props[
'aria-label'
];
const expandedDescription = wrapper.find('button').prop('title');
expect(expandedDescription).toEqual(defaultExpandedIconText);
});

Expand All @@ -313,17 +310,15 @@ describe('Tile', () => {

// Force the expanded tile to be collapsed.
wrapper.setState({ expanded: false });
const collapsedDescription = wrapper.find('button').getElements()[0]
.props['aria-label'];
const collapsedDescription = wrapper.find('button').prop('title');

expect(collapsedDescription).toEqual(tileCollapsedIconText);

// click on the item to expand it.
wrapper.simulate('click');

// Validate the description change
const expandedDescription = wrapper.find('button').getElements()[0].props[
'aria-label'
];
const expandedDescription = wrapper.find('button').prop('title');
expect(expandedDescription).toEqual(tileExpandedIconText);
});

Expand Down
16 changes: 6 additions & 10 deletions packages/react/src/components/Tile/Tile.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,15 +542,16 @@ export class ExpandableTile extends Component {

return (
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
<div
<button
ref={tile => {
this.tile = tile;
}}
style={tileStyle}
className={classes}
aria-expanded={isExpanded}
title={isExpanded ? tileExpandedIconText : tileCollapsedIconText}
{...other}
onClick={this.handleClick}
onKeyPress={this.handleKeyDown}
tabIndex={tabIndex}>
<div
ref={tileContent => {
Expand All @@ -563,17 +564,12 @@ export class ExpandableTile extends Component {
className={`${prefix}--tile-content`}>
{childrenAsArray[0]}
</div>
<button
aria-expanded={isExpanded}
aria-label={
isExpanded ? tileExpandedIconText : tileCollapsedIconText
}
className={`${prefix}--tile__chevron`}>
<div className={`${prefix}--tile__chevron`}>
<ChevronDown16 />
</button>
</div>
<div className={`${prefix}--tile-content`}>{childrenAsArray[1]}</div>
</div>
</div>
</button>
);
}
}
Expand Down

0 comments on commit c63d94b

Please sign in to comment.