RCFilters: Add title attribute to highlighted rows
For accessibility and screen readers, add the actual highlighted filter names to a title attribute in rows that are highlighted. Bug: T173608 Change-Id: Id71a45621e545897988010acfd054760a617b1f1
This commit is contained in:
parent
0b302de486
commit
538d1d2c9e
4 changed files with 30 additions and 1 deletions
|
|
@ -1362,6 +1362,7 @@
|
|||
"rcfilters-hours-title": "Recent hours",
|
||||
"rcfilters-days-show-days": "$1 {{PLURAL:$1|day|days}}",
|
||||
"rcfilters-days-show-hours": "$1 {{PLURAL:$1|hour|hours}}",
|
||||
"rcfilters-highlighted-filters-list": "Highlighted: $1",
|
||||
"rcfilters-quickfilters": "Saved filters",
|
||||
"rcfilters-quickfilters-placeholder-title": "No links saved yet",
|
||||
"rcfilters-quickfilters-placeholder-description": "To save your filter settings and reuse them later, click the bookmark icon in the Active Filter area, below.",
|
||||
|
|
|
|||
|
|
@ -1552,6 +1552,7 @@
|
|||
"rcfilters-hours-title": "Title for the options to change the number of hours for the results shown.",
|
||||
"rcfilters-days-show-days": "Title for the button that opens the operation to control the day range for the results. \n\nParameters: $1 - Number of days shown",
|
||||
"rcfilters-days-show-hours": "Title for the button that opens the operation to control the hour range for the results. \n\nParameters: $1 - Number of hours shown",
|
||||
"rcfilters-highlighted-filters-list": "Text for the tooltip that is displayed over highlighted results, specifying which filters the result matches in [[Special:RecentChanges]] when RCFilters are enabled. \n\nParameters: $1 - A comma separated list of matching filter names.",
|
||||
"rcfilters-quickfilters": "Label for the button that opens the saved filter settings menu in [[Special:RecentChanges]]",
|
||||
"rcfilters-quickfilters-placeholder-title": "Title for the text shown in the quick filters menu on [[Special:RecentChanges]] if the user has not saved any quick filters.",
|
||||
"rcfilters-quickfilters-placeholder-description": "Description for the text shown in the quick filters menu on [[Special:RecentChanges]] if the user has not saved any quick filters.",
|
||||
|
|
|
|||
|
|
@ -1842,6 +1842,7 @@ return [
|
|||
'rcfilters-hours-title',
|
||||
'rcfilters-days-show-days',
|
||||
'rcfilters-days-show-hours',
|
||||
'rcfilters-highlighted-filters-list',
|
||||
'rcfilters-quickfilters',
|
||||
'rcfilters-quickfilters-placeholder-title',
|
||||
'rcfilters-quickfilters-placeholder-description',
|
||||
|
|
|
|||
|
|
@ -303,10 +303,33 @@
|
|||
}
|
||||
|
||||
this.filtersViewModel.getHighlightedItems().forEach( function ( filterItem ) {
|
||||
var $elements = this.$element.find( '.' + filterItem.getCssClass() );
|
||||
|
||||
// Add highlight class to all highlighted list items
|
||||
this.$element.find( '.' + filterItem.getCssClass() )
|
||||
$elements
|
||||
.addClass( 'mw-rcfilters-highlight-color-' + filterItem.getHighlightColor() );
|
||||
|
||||
$elements.each( function () {
|
||||
var filterString = $( this ).attr( 'data-highlightedFilters' ) || '',
|
||||
filters = filterString ? filterString.split( '|' ) : [];
|
||||
|
||||
if ( filters.indexOf( filterItem.getLabel() ) === -1 ) {
|
||||
filters.push( filterItem.getLabel() );
|
||||
}
|
||||
|
||||
$( this )
|
||||
.attr( 'data-highlightedFilters', filters.join( '|' ) );
|
||||
} );
|
||||
}.bind( this ) );
|
||||
// Apply a title for relevant filters
|
||||
this.$element.find( '[data-highlightedFilters]' ).each( function () {
|
||||
var filterString = $( this ).attr( 'data-highlightedFilters' ) || '',
|
||||
filters = filterString ? filterString.split( '|' ) : [];
|
||||
|
||||
if ( filterString ) {
|
||||
$( this ).attr( 'title', mw.msg( 'rcfilters-highlighted-filters-list', filters.join( ', ' ) ) );
|
||||
}
|
||||
} );
|
||||
|
||||
// Turn on highlights
|
||||
this.$element.addClass( 'mw-rcfilters-ui-changesListWrapperWidget-highlighted' );
|
||||
|
|
@ -321,6 +344,9 @@
|
|||
this.$element.find( '.mw-rcfilters-highlight-color-' + color ).removeClass( 'mw-rcfilters-highlight-color-' + color );
|
||||
}.bind( this ) );
|
||||
|
||||
this.$element.find( '[data-highlightedFilters]' )
|
||||
.removeAttr( 'title' )
|
||||
.removeAttr( 'data-highlightedFilters' );
|
||||
// Turn off highlights
|
||||
this.$element.removeClass( 'mw-rcfilters-ui-changesListWrapperWidget-highlighted' );
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue