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