mirror of
https://github.com/videojs/video.js.git
synced 2024-12-27 02:43:45 +02:00
fix: Set alt attr on poster img (#8043)
* fix: Set alt attr on poster img * use null alt instead * remove debug text
This commit is contained in:
parent
e21d295d77
commit
3accbc7c73
@ -46,15 +46,21 @@ class PosterImage extends ClickableComponent {
|
|||||||
* The element that gets created.
|
* The element that gets created.
|
||||||
*/
|
*/
|
||||||
createEl() {
|
createEl() {
|
||||||
const el = Dom.createEl('picture', {
|
const el = Dom.createEl(
|
||||||
className: 'vjs-poster',
|
'picture', {
|
||||||
|
className: 'vjs-poster',
|
||||||
|
|
||||||
// Don't want poster to be tabbable.
|
// Don't want poster to be tabbable.
|
||||||
tabIndex: -1
|
tabIndex: -1
|
||||||
}, {}, Dom.createEl('img', {
|
},
|
||||||
loading: 'lazy',
|
{},
|
||||||
crossOrigin: this.crossOrigin()
|
Dom.createEl('img', {
|
||||||
}));
|
loading: 'lazy',
|
||||||
|
crossOrigin: this.crossOrigin()
|
||||||
|
}, {
|
||||||
|
alt: ''
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
return el;
|
return el;
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,12 @@ QUnit.test('should mirror crossOrigin', function(assert) {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
QUnit.test('should populate an alt attribute', function(assert) {
|
||||||
|
const posterImage = new PosterImage(this.mockPlayer);
|
||||||
|
|
||||||
|
assert.ok(posterImage.$('img').hasAttribute('alt'), 'img has alt atttribute');
|
||||||
|
});
|
||||||
|
|
||||||
QUnit.test('should remove itself from the document flow when there is no poster', function(assert) {
|
QUnit.test('should remove itself from the document flow when there is no poster', function(assert) {
|
||||||
const posterImage = new PosterImage(this.mockPlayer);
|
const posterImage = new PosterImage(this.mockPlayer);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user