Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing 'controlsList' Attribute in HTMLVideoElement Type Definition Throws TypeScript Error #6015

Closed
3 tasks done
buddyeorl opened this issue Oct 6, 2024 · 1 comment · Fixed by #6026
Closed
3 tasks done
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil Help Wanted

Comments

@buddyeorl
Copy link

Prerequisites

Stencil Version

4.7.0

Current Behavior

When trying to use the controlsList attribute on an <video> element in a Stencil component, TypeScript raises an error indicating that the attribute is not recognized in the VideoHTMLAttributes<HTMLVideoElement> type definition.

Expected Behavior

The <video> element should accept the controlsList attribute without TypeScript throwing an error. This attribute is a standard part of the HTML5 specification, allowing for better control over the user's access to video features like downloading.

System Info

System: node 20.17.0
    Platform: darwin (23.4.0)
   CPU Model: Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz (16 cpus)
    Compiler: pathToComponent/node_modules/@stencil/core/compiler/stencil.js
       Build: 1727982169
     Stencil: 4.22.0 🍲
  TypeScript: 5.5.4
      Rollup: 2.56.3
      Parse5: 7.1.2
      jQuery: 4.0.0-pre
      Terser: 5.31.1

Steps to Reproduce

Steps to reproduce:

  • Create a Stencil component with a <video> element.
  • Attempt to use controlsList="nodownload" as an attribute.
  • Observe the TypeScript error as shown above.
  import { Component, h } from '@stencil/core';
  @Component({
    tag: 'video-player',
    shadow: true,
  })
  export class VideoPlayer {
    render() {
      return (
          <video class="video-player" controls autoplay controlsList='nodownload' preload="metadata">
            <source src="https://raw.githubusercontent.com/mdn/learning-area/refs/heads/main/html/multimedia-and-embedding/video-and-audio-content/rabbit320.mp4" type="video/mp4" />
            Your browser does not support the video tag.
          </video>
      );
    }
  }

Currently I'm using this workaround to prevent ts from throwing that error, but would love to have it fix:

        <video class="video-player" controls autoplay {...({ controlsList: 'nodownload' } as any)} preload="metadata">
          <source src="https://raw.githubusercontent.com/mdn/learning-area/refs/heads/main/html/multimedia-and-embedding/video-and-audio-content/rabbit320.mp4" type="video/mp4" />
          Your browser does not support the video tag.
        </video>

Code Reproduction URL

n/a

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Oct 6, 2024
@christian-bromann christian-bromann added Bug: Validated This PR or Issue is verified to be a bug within Stencil and removed triage labels Oct 7, 2024
@christian-bromann
Copy link
Member

@buddyeorl thank you for filing the issue. Unfortunately our team currently has a lot of competing priorities and we are not sure when we can take a look at this. We would appreciate any support on a potential bug fix. We are happy to help on technical questions.

rwaskiewicz added a commit to rwaskiewicz/stencil that referenced this issue Oct 11, 2024
prior to this commit, using the `controlslist` attribute in a `video`
or `audio` element would result in a type checking error. with this
commit, we allow the attribute to take one of three values:
- nodownload
- nofullscreen
- noremoteplayback

note that at the time of this writing, only chromium browsers support
this attribute. it is the responsibilty of end users to determine if
using this attribute is appropraite for their projects.

fixes: stenciljs#6015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil Help Wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants