Commit f64bf4c0 by Chris Rodriguez

Revert "AC-454 adding visual clarify for selected menu options"

This reverts commit 41756165.
parent ef213488
......@@ -535,8 +535,6 @@
.speed-option,
.control-lang {
@include border-left($baseline/10 solid rgb(14, 166, 236));
font-weight: $font-bold;
color: rgb(14, 166, 236); // UXPL primary accent
}
}
......
......@@ -266,7 +266,6 @@
expect($('.closed-captions')).toHaveAttrs({
'lang': 'de'
});
expect(link).toHaveAttr('aria-pressed', 'true');
});
it('when clicking on link with current language', function () {
......@@ -285,7 +284,6 @@
expect(state.storage.setItem)
.not.toHaveBeenCalledWith('language', 'en');
expect($('.langs-list li.is-active').length).toBe(1);
expect(link).toHaveAttr('aria-pressed', 'true');
});
it('open the language toggle on hover', function () {
......
......@@ -203,18 +203,16 @@
describe('onSpeedChange', function () {
beforeEach(function () {
state = jasmine.initializePlayer();
$('li[data-speed="1.0"]').addClass('is-active').attr('aria-pressed', 'true');
$('li[data-speed="1.0"]').addClass('is-active');
state.videoSpeedControl.setSpeed(0.75);
});
it('set the new speed as active', function () {
expect($('li[data-speed="1.0"]')).not.toHaveClass('is-active');
expect($('li[data-speed="1.0"] .speed-option').attr('aria-pressed')).not.toEqual('true');
expect($('li[data-speed="0.75"]')).toHaveClass('is-active');
expect($('li[data-speed="0.75"] .speed-option').attr('aria-pressed')).toEqual('true');
expect($('.speeds .speed-button .value')).toHaveHtml('0.75x');
expect($('.video-speeds li[data-speed="1.0"]'))
.not.toHaveClass('is-active');
expect($('.video-speeds li[data-speed="0.75"]'))
.toHaveClass('is-active');
expect($('.speeds .value')).toHaveHtml('0.75x');
});
});
......
......@@ -95,15 +95,14 @@ function (Iterator) {
* Creates any necessary DOM elements, attach them, and set their,
* initial configuration.
* @param {array} speeds List of speeds available for the player.
* @param {string} currentSpeed The current speed set to the player.
*/
render: function (speeds, currentSpeed) {
render: function (speeds) {
var speedsContainer = this.speedsContainer,
reversedSpeeds = speeds.concat().reverse(),
speedsList = $.map(reversedSpeeds, function (speed) {
return [
'<li data-speed="', speed, '">',
'<button class="control speed-option" tabindex="-1" aria-pressed="false">',
'<button class="control speed-option" tabindex="-1">',
speed, 'x',
'</button>',
'</li>'
......@@ -113,7 +112,6 @@ function (Iterator) {
speedsContainer.html(speedsList.join(''));
this.speedLinks = new Iterator(speedsContainer.find('.speed-option'));
this.state.el.find('.secondary-controls').prepend(this.el);
this.setActiveSpeed(currentSpeed);
},
/**
......@@ -218,38 +216,17 @@ function (Iterator) {
if (speed !== this.currentSpeed || forceUpdate) {
this.speedsContainer
.find('li')
.siblings("li[data-speed='" + speed + "']");
.removeClass('is-active')
.siblings("li[data-speed='" + speed + "']")
.addClass('is-active');
this.speedButton.find('.value').text(speed + 'x');
this.speedButton.find('.value').html(speed + 'x');
this.currentSpeed = speed;
if (!silent) {
this.el.trigger('speedchange', [speed, this.state.speed]);
}
}
this.resetActiveSpeed();
this.setActiveSpeed(speed);
},
resetActiveSpeed: function() {
var speedOptions = this.speedsContainer.find('li');
$(speedOptions).each(function(index, el) {
$(el).removeClass('is-active')
.find('.speed-option')
.attr('aria-pressed', 'false');
});
},
setActiveSpeed: function(speed) {
var speedOption = this.speedsContainer.find('li[data-speed="' + speed + '"]');
speedOption.addClass('is-active')
.find('.speed-option')
.attr('aria-pressed', 'true');
this.speedButton.attr('title', gettext('Video speed: ') + speed + 'x');
},
/**
......@@ -267,13 +244,10 @@ function (Iterator) {
* @param {jquery Event} event
*/
clickLinkHandler: function (event) {
var el = $(event.currentTarget).parent(),
speed = $(el).data('speed');
var speed = $(event.currentTarget).parent().data('speed');
this.resetActiveSpeed();
this.setActiveSpeed(speed);
this.closeMenu();
this.state.videoCommands.execute('speed', speed);
this.closeMenu(true);
return false;
},
......
......@@ -662,11 +662,10 @@
$.each(languages, function(code, label) {
var li = $('<li data-lang-code="' + code + '" />'),
link = $('<button class="control control-lang" aria-pressed="false">' + label + '</button>');
link = $('<button class="control control-lang">' + label + '</button>');
if (currentLang === code) {
li.addClass('is-active');
link.attr('aria-pressed', 'true');
}
li.append(link);
......@@ -684,11 +683,7 @@
state.lang = langCode;
el .addClass('is-active')
.siblings('li')
.removeClass('is-active')
.find('.control-lang')
.attr('aria-pressed', 'false');
$(e.currentTarget).attr('aria-pressed', 'true');
.removeClass('is-active');
state.el.trigger('language_menu:change', [langCode]);
self.fetchCaption();
......@@ -698,7 +693,6 @@
// update the transcript lang attribute
self.subtitlesMenuEl.attr('lang', langCode);
self.closeLanguageMenu(e);
}
});
},
......@@ -721,7 +715,7 @@
'data-index': index,
'data-start': start[index],
'tabindex': 0
}).text(text);
}).html(text);
return liEl[0];
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment