fix: remove inline style applied to iframe (#2343)

This commit is contained in:
Yu Long
2023-10-09 11:31:53 +02:00
committed by GitHub
parent 5e51574984
commit afaa66951b
6 changed files with 18 additions and 9 deletions

View File

@@ -0,0 +1,5 @@
---
"@adyen/adyen-web": patch
---
fix: remove inline style applied to iframe

View File

@@ -0,0 +1,3 @@
.adyen-checkout__iframe{
border: 0;
}

View File

@@ -1,5 +1,6 @@
import { Component, h } from 'preact';
import classNames from 'classnames';
import './Iframe.scss';
interface IframeProps {
width?: string;
@@ -75,7 +76,6 @@ class Iframe extends Component<IframeProps> {
src={src}
width={width}
height={height}
style={{ border: 0 }}
frameBorder="0"
title={title}
/* eslint-disable react/no-unknown-property */

View File

@@ -0,0 +1,6 @@
.js-iframe {
border: none;
height: 100%;
width: 100%;
overflow: hidden;
}

View File

@@ -28,6 +28,7 @@ import { processAriaConfig } from './utils/processAriaConfig';
import { processPlaceholders } from './utils/processPlaceholders';
import Language from '../../../../../language/Language';
import { hasOwnProperty } from '../../../../../utils/hasOwnProperty';
import './SecuredField.scss';
const logPostMsg = false;
const doLog = false;

View File

@@ -1,12 +1,7 @@
export default function createIframe({
src,
title = 'iframe element',
policy = 'origin',
styleStr = 'border: none; height:100%; width:100%; overflow:hidden;'
}) {
export default function createIframe({ src, title = 'iframe element', policy = 'origin' }) {
const iframeEl = document.createElement('iframe');
iframeEl.setAttribute('src', src);
iframeEl.setAttribute('class', 'js-iframe');
iframeEl.classList.add('js-iframe');
// For a11y some merchants want to be able to remove the title element on the iframe - seeing the info it carries as extraneous for the screenreader
if (title === '' || title.trim().length === 0 || title === 'none') {
iframeEl.setAttribute('role', 'presentation');
@@ -15,7 +10,6 @@ export default function createIframe({
}
iframeEl.setAttribute('allowtransparency', 'true');
iframeEl.setAttribute('style', styleStr);
iframeEl.setAttribute('referrerpolicy', policy); // Necessary for ClientKey to work
// Commenting out stops the "The devicemotion events are blocked by feature policy" warning in Chrome >=66 that some merchant experienced
// Commenting in stops the same warnings in development (??)