-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fixes #12639 It's now possible to tab to each filter's actions and interact with them via the keyboard. In order to get the actions to show/hide on both mouse hover and action focus I had to create a new filter-pill component that could manage a bit of state to track whether the user was interacting with a given pill or not.
- Loading branch information
Showing
6 changed files
with
135 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<div | ||
class="filter" | ||
ng-class="{ negate: pill.filter.meta.negate, disabled: pill.filter.meta.disabled }" | ||
data-test-subj="filter filter-{{ pill.filter.meta.disabled ? 'disabled' : 'enabled' }} {{ pill.filter.meta.key ? 'filter-key-' + pill.filter.meta.key : '' }} {{ pill.filter.meta.value ? 'filter-value-' + pill.filter.meta.value : '' }}" | ||
ng-mouseover="pill.activateActions()" | ||
ng-mouseleave="pill.deactivateActions()" | ||
> | ||
|
||
<div class="filter-description" ng-class="{'filter-description-deactivated': pill.areActionsActivated}"> | ||
<span ng-if="pill.filter.$state.store == 'globalState'"><i class="fa fa-fw fa-thumb-tack pinned"></i></span> | ||
<span ng-if="pill.filter.meta.alias">{{ pill.filter.meta.alias }}</span> | ||
<span ng-if="!pill.filter.meta.alias">{{ pill.filter.meta.key }}:</span> | ||
<span ng-if="!pill.filter.meta.alias">"{{ pill.filter.meta.value }}"</span> | ||
</div> | ||
|
||
<div class="filter-actions" ng-class="{'filter-actions-activated': pill.areActionsActivated}"> | ||
<button | ||
class="action filter-toggle" | ||
ng-click="pill.onToggleFilter(pill.filter)" | ||
data-test-subj="disableFilter-{{ pill.filter.meta.key }}" | ||
ng-focus="pill.activateActions()" | ||
ng-blur="pill.deactivateActions()" | ||
aria-label="{{pill.filter.meta.disabled ? 'Enable filter' : 'Disable filter'}}" | ||
> | ||
<i ng-show="pill.filter.meta.disabled" class="fa fa-fw fa-square-o disabled"></i> | ||
<i ng-hide="pill.filter.meta.disabled" class="fa fa-fw fa-check-square-o enabled"></i> | ||
</button> | ||
|
||
<button | ||
class="action filter-pin" | ||
ng-click="pill.onPinFilter(pill.filter)" | ||
data-test-subj="pinFilter-{{ pill.filter.meta.key }}" | ||
ng-focus="pill.activateActions()" | ||
ng-blur="pill.deactivateActions()" | ||
aria-label="{{pill.filter.$state.store == 'globalState' ? 'Unpin filter' : 'Pin filter'}}" | ||
> | ||
<i ng-show="pill.filter.$state.store == 'globalState'" class="fa fa-fw fa-thumb-tack pinned"></i> | ||
<i ng-hide="pill.filter.$state.store == 'globalState'" class="fa fa-fw fa-thumb-tack fa-rotate-270 unpinned"></i> | ||
</button> | ||
|
||
<button | ||
class="action filter-invert" | ||
ng-click="pill.onInvertFilter(pill.filter)" | ||
data-test-subj="invertFilter-{{ pill.filter.meta.key }}" | ||
ng-focus="pill.activateActions()" | ||
ng-blur="pill.deactivateActions()" | ||
aria-label="Invert filter" | ||
> | ||
<i ng-show="pill.filter.meta.negate" class="fa fa-fw fa-search-plus negative"></i> | ||
<i ng-hide="pill.filter.meta.negate" class="fa fa-fw fa-search-minus positive"></i> | ||
</button> | ||
|
||
<button | ||
class="action filter-remove" | ||
ng-click="pill.onDeleteFilter(pill.filter)" | ||
ng-focus="pill.activateActions()" | ||
ng-blur="pill.deactivateActions()" | ||
aria-label="Remove filter" | ||
> | ||
<i class="fa fa-fw fa-trash" data-test-subj="removeFilter-{{ pill.filter.meta.key }}"></i> | ||
</button> | ||
|
||
<button | ||
class="action filter-edit" | ||
ng-click="pill.onEditFilter(pill.filter)" | ||
ng-focus="pill.activateActions()" | ||
ng-blur="pill.deactivateActions()" | ||
aria-label="Edit filter" | ||
> | ||
<i class="fa fa-fw fa-edit"></i> | ||
</button> | ||
|
||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import template from './filter_pill.html'; | ||
import { uiModules } from 'ui/modules'; | ||
|
||
const module = uiModules.get('kibana'); | ||
|
||
module.directive('filterPill', function () { | ||
return { | ||
template, | ||
restrict: 'E', | ||
scope: { | ||
filter: '=', | ||
onToggleFilter: '=', | ||
onPinFilter: '=', | ||
onInvertFilter: '=', | ||
onDeleteFilter: '=', | ||
onEditFilter: '=', | ||
}, | ||
bindToController: true, | ||
controllerAs: 'pill', | ||
controller: function filterPillController() { | ||
|
||
this.activateActions = () => { | ||
this.areActionsActivated = true; | ||
}; | ||
|
||
this.deactivateActions = () => { | ||
this.areActionsActivated = false; | ||
}; | ||
|
||
} | ||
}; | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters