New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 843421 link

Starred by 4 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug



Sign in to add a comment

createElement('button', {is: 'google-cast-button'}) doesn't work

Reported by jws.f...@gmail.com, May 16 2018

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36

Example URL:
https://codepen.io/acroyear/pen/wjEEQq

Steps to reproduce the problem:
1. Create a web page and include the v1 CAF framework script.
2. Use document.createElement to create a google-cast-button using the proper standard syntax of {is: 'google-cast-button} instead of just the string alone, which is based on an older version of the specification.

What is the expected behavior?
It should still work just like the string version.

What went wrong?
It doesn't work. you get an empty button.

Does it occur on multiple sites: N/A

Is it a problem with a plugin? N/A 

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 66.0.3359.139  Channel: stable
OS Version: OS X 10.12.6
Flash Version: Shockwave Flash 29.0 r0

This is a problem in using react.js - react is translating the syntax from the JSX into a createElement call using the standard's syntax, which Chrome documentation says should be supported, but it clearly doesn't work. This means that I have to create the button (the 'wrong' way) by hand and insert it into the DOM and it means I don't get the full benefit of many of the features of react frameworks like Material-UI.
 

Comment 1 by jws.f...@gmail.com, May 16 2018

It is also not working properly on Chrome Dev 68.0.3425.0 for Android 8.
Labels: Needs-Triage-M66

Comment 3 by tkent@chromium.org, May 16 2018

Components: Blink>HTML>CustomElements
Status: WontFix (was: Unconfirmed)
gcast framework registers google-cast-button with the old API, document.registerElement().  So you can create it only with the old syntax, document.createElement('button', 'google-cast-button').

The standard syntax supports only elements registered by window.customElements.define().


Comment 4 by jws.f...@gmail.com, May 16 2018

So when will this upgrade and follow the updated API instead of the ancient one? As I said, it is causing problems when other libraries presume that the standard syntax works in all 'is' cases?

Comment 5 by tkent@chromium.org, May 16 2018

Components: -Blink>HTML>CustomElements Internals>Cast
Status: Untriaged (was: WontFix)
Route to cast team.

Comment 6 by jws.f...@gmail.com, May 16 2018

Context: I'm writing a PWA music player app (in react and material-ui) and would like to have the cast button on the screen rather than having the user route through the settings on Google Home. Currently I have to hack around react using the {is: } syntax by creating the button myself, and in doing so, I can't get material-ui to style it correctly so I have to hack that aspect as well.
Labels: -Type-Compat M-68 Triaged-ET FoundIn-68 Target-68 OS-Linux OS-Windows Type-Bug
Able to reproduce the issue on Mac 10.13.3, Win-10 and Ubuntu 17.10 using chrome reported version #66.0.3359.139 and latest canary #68.0.3431.0.
This is a non-regression issue as it is observed from M60 old builds. 

Hence, marking it as untriaged to get more inputs from dev team.

Thanks...!!

Comment 8 by mfo...@chromium.org, May 29 2018

Components: -Internals>Cast Internals>Cast>Providers
Owner: johnpallett@chromium.org
Status: Available (was: Untriaged)
We'll file an internal bug against the relevant team to follow up.  Thanks for the report.

Comment 9 by mfo...@chromium.org, May 30 2018

Cc: kochi@chromium.org

Comment 10 by jws.f...@gmail.com, May 31 2018

For those hitting this as well, my workaround approach is to have a ChromecastButton component that just renders a normal button inside a div with what classNames I want, then

  componentDidMount() {
      const button = this.myRef.current.firstChild;
      // const castButton = document.createElement('button', {is: 'google-cast-button'});
      // SHOULD work, but doesn't.
      const castButton = document.createElement('button', 'google-cast-button');
      castButton.className = button.className;
      this.myRef.current.replaceChild(castButton, button);
  }

that takes the button and swaps it out with the newly created cast button that works. you generally shouldn't need your own event handlers on the button to swap out because the whole point is to have google-cast-button just magically do it all for you. if needed, you can swap out style attribute as well.
We've been able to reproduce the issue and will be releasing an update for the Cast Web Sender SDK soon along with updates in the documentation.
neosapien@: Please update this issue when the new sender SDK has been merged into M68.
We've just added a new launcher element consistent with the new webcomponent syntax. <google-cast-launcher></google-cast-launcher> or document.createElement('google-cast-launcher')

The old button will still work but if you're using react or the new custom element syntax you can use the new element. We will update the developer docs to reflect this change.
already working for me (including in react). thanks.
Status: Assigned (was: Available)
Owner: powerb@chromium.org

Sign in to add a comment