Skip to content
This repository was archived by the owner on Jul 3, 2023. It is now read-only.
This repository was archived by the owner on Jul 3, 2023. It is now read-only.

Enable way to pass more props through to iframe element #10

@breadadams

Description

@breadadams

Currently to be able to set any other props/attributes on the iframe element we have to do so via the ref on mount (eg. with useEffect):

useEffect(() => {
  if (ref && ref.current && ref.current.frame) {
    ref.current.frame.id = "frame-id";
    ref.current.frame.setAttribute("allow", "microphone; camera");
  }
}, [])

To avoid this, and also avoid having props for each possible attribute, there could be an iframeProps prop that gets destructured here (before the defaults):

chrome-sidebar/src/frame.js

Lines 100 to 109 in ae9f07e

<iframe
className={cx({
[iframeClass]: true,
[iframeClassName]: true
})}
style={iframeStyle}
src={url}
ref={frame => this.frame = frame}
onLoad={this.onLoad}
/>

eg.

<iframe
   {...iframeProps}
   className={cx({ 
     [iframeClass]: true, 
     [iframeClassName]: true 
   })} 
   style={iframeStyle} 
   src={url} 
   ref={frame => this.frame = frame} 
   onLoad={this.onLoad} 
 /> 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions