Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1964 from matrix-org/t3chguy/tag_panel_a11y
Browse files Browse the repository at this point in the history
fix styling of clearButton when its not there
  • Loading branch information
dbkr committed Jun 14, 2018
2 parents 7029e9a + 3b50113 commit 5523c1e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
7 changes: 5 additions & 2 deletions res/css/structures/_TagPanel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,18 @@ limitations under the License.
.mx_TagPanel {
flex: 0 0 60px;
background-color: $tertiary-accent-color;
cursor: pointer;

display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
}

.mx_TagPanel .mx_TagPanel_clearButton {
.mx_TagPanel_items_selected {
cursor: pointer;
}

.mx_TagPanel .mx_TagPanel_clearButton_container {
/* Constant height within flex mx_TagPanel */
height: 70px;
width: 60px;
Expand Down
17 changes: 13 additions & 4 deletions src/components/structures/TagPanel.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2017 New Vector Ltd.
Copyright 2017, 2018 New Vector Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -26,6 +26,7 @@ import dis from '../../dispatcher';
import { _t } from '../../languageHandler';

import { Droppable } from 'react-beautiful-dnd';
import classNames from 'classnames';

const TagPanel = React.createClass({
displayName: 'TagPanel',
Expand Down Expand Up @@ -116,8 +117,10 @@ const TagPanel = React.createClass({
/>;
});

const itemsSelected = this.state.selectedTags.length > 0;

let clearButton;
if (this.state.selectedTags.length > 0) {
if (itemsSelected) {
clearButton = <AccessibleButton className="mx_TagPanel_clearButton" onClick={this.onClearFilterClick}>
<TintableSvg src="img/icons-close.svg" width="24" height="24"
alt={_t("Clear filter")}
Expand All @@ -126,8 +129,14 @@ const TagPanel = React.createClass({
</AccessibleButton>;
}

return <div className="mx_TagPanel">
{ clearButton }
const classes = classNames('mx_TagPanel', {
mx_TagPanel_items_selected: itemsSelected,
});

return <div className={classes}>
<div className="mx_TagPanel_clearButton_container">
{ clearButton }
</div>
<div className="mx_TagPanel_divider" />
<GeminiScrollbarWrapper
className="mx_TagPanel_scroller"
Expand Down

0 comments on commit 5523c1e

Please sign in to comment.