Merge "Disable hidden radio buttons on page history to fix behavior on Firefox"

This commit is contained in:
jenkins-bot 2021-09-14 21:49:22 +00:00 committed by Gerrit Code Review
commit 04820b38cd
3 changed files with 18 additions and 1 deletions

View file

@ -640,7 +640,9 @@ class HistoryPager extends ReverseChronologicalPager {
if ( $firstInList ) {
$first = Xml::element( 'input',
array_merge( $radio, [
'style' => 'visibility:hidden',
// Disable the hidden radio because it can still
// be selected with arrow keys on Firefox
'disabled' => '',
'name' => 'oldid',
'id' => 'mw-oldid-null' ] )
);

View file

@ -38,12 +38,18 @@ $( function () {
if ( $oldidRadio.prop( 'checked' ) ) {
$li.addClass( 'selected after' );
nextState = 'after';
// Disable the hidden radio because it can still be selected with
// arrow keys on Firefox
$diffRadio.prop( 'disabled', true );
} else if ( $diffRadio.prop( 'checked' ) ) {
// The following classes are used here:
// * before
// * after
$li.addClass( 'selected ' + nextState );
nextState = 'between';
// Disable the hidden radio because it can still be selected with
// arrow keys on Firefox
$oldidRadio.prop( 'disabled', true );
} else {
// This list item has neither checked
// apply the appropriate class following the previous item.
@ -51,6 +57,11 @@ $( function () {
// * before
// * after
$li.addClass( nextState );
// Disable or re-enable for Firefox, provided the revision is accessible
if ( $li.find( 'a.mw-changeslist-date' ).length ) {
$oldidRadio.prop( 'disabled', nextState === 'before' );
$diffRadio.prop( 'disabled', nextState === 'after' );
}
}
} );

View file

@ -38,6 +38,10 @@
}
}
#mw-oldid-null {
visibility: hidden;
}
.updatedmarker {
background-color: #b7f430;
}