mirror of
https://github.com/videojs/video.js.git
synced 2025-01-02 06:32:07 +02:00
feat(player): Make 'searchForTrackSelect_' private & use 'el' as parameter in function 'getIsFocusable' (#8697)
This commit is contained in:
parent
21b4a5225b
commit
ec69d5e620
@ -1840,8 +1840,10 @@ class Component {
|
||||
* @return {boolean}
|
||||
* If the component can be focused, will be `true`. Otherwise, `false`.
|
||||
*/
|
||||
getIsFocusable() {
|
||||
return this.el_.tabIndex >= 0 && !(this.getIsDisabled() || this.getIsExpresslyInert());
|
||||
getIsFocusable(el) {
|
||||
const element = el || this.el_;
|
||||
|
||||
return element.tabIndex >= 0 && !(this.getIsDisabled() || this.getIsExpresslyInert());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -188,7 +188,7 @@ class SpatialNavigation extends EventTarget {
|
||||
|
||||
// If nextFocusedElement is the 'TextTrackSettings' component
|
||||
if (nextFocusedElement.classList.contains('vjs-text-track-settings') && !this.isPaused_) {
|
||||
this.searchForTrackSelect();
|
||||
this.searchForTrackSelect_();
|
||||
}
|
||||
}
|
||||
|
||||
@ -288,7 +288,7 @@ class SpatialNavigation extends EventTarget {
|
||||
* or `null` if no suitable child is found.
|
||||
*/
|
||||
function searchForSuitableChild(node) {
|
||||
if (component.getIsFocusable() && component.getIsAvailableToBeFocused(node)) {
|
||||
if (component.getIsFocusable(node) && component.getIsAvailableToBeFocused(node)) {
|
||||
return node;
|
||||
}
|
||||
|
||||
@ -537,8 +537,10 @@ class SpatialNavigation extends EventTarget {
|
||||
/**
|
||||
* This gets called by 'handlePlayerBlur_' if 'spatialNavigation' is enabled.
|
||||
* Searches for the first 'TextTrackSelect' inside of modal to focus.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
searchForTrackSelect() {
|
||||
searchForTrackSelect_() {
|
||||
const spatialNavigation = this;
|
||||
|
||||
for (const component of (spatialNavigation.updateFocusableComponents())) {
|
||||
|
@ -476,7 +476,7 @@ QUnit.test('should call `searchForTrackSelect()` if spatial navigation is enable
|
||||
Object.defineProperty(clickEvent, 'relatedTarget', {writable: false, value: element});
|
||||
Object.defineProperty(clickEvent, 'currentTarget', {writable: false, value: element});
|
||||
|
||||
const trackSelectSpy = sinon.spy(this.spatialNav, 'searchForTrackSelect');
|
||||
const trackSelectSpy = sinon.spy(this.spatialNav, 'searchForTrackSelect_');
|
||||
|
||||
const textTrackSelectComponent = new TextTrackSelect(this.player, {
|
||||
SelectOptions: ['Option 1', 'Option 2', 'Option 3'],
|
||||
|
Loading…
Reference in New Issue
Block a user