Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ui/buttons/button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ export function Button({
].join(" ")}
>
<div
role="link"
role="presentation"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be added to the iframe itself and not the inner div.

{...{
[ATTRIBUTE.BUTTON]: true,
[ATTRIBUTE.FUNDING_SOURCE]: fundingSource,
Expand Down
5 changes: 3 additions & 2 deletions src/zoid/buttons/component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,15 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
attributes: ({ props }) => {
let fundingSource = "";
if (props.fundingSource) {
fundingSource = `-${props.fundingSource}`;
fundingSource = ` ${props.fundingSource}`;
}

return {
iframe: {
allowpaymentrequest: "allowpaymentrequest",
scrolling: "no",
title: `${FUNDING_BRAND_LABEL.PAYPAL}${fundingSource}`,
// $FlowFixMe[prop-missing] PAYWITH property exists in local constants
title: `${FUNDING_BRAND_LABEL.PAYWITH}${fundingSource}`,
},
};
},
Expand Down
14 changes: 11 additions & 3 deletions test/integration/tests/button/instant.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ for (const flow of ["popup", "iframe"]) {

// $FlowFixMe
const win = frame.contentWindow;
const button = win.document.querySelector('[role="link"]');
const button = win.document.querySelector("[data-button]");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we do not need to change the role here we want it to stay link, we just want to add the role on the iframe


frame.click();
button.click();
Expand Down Expand Up @@ -77,7 +77,11 @@ for (const flow of ["popup", "iframe"]) {

// $FlowFixMe
const win = frame.contentWindow;
const button = win.document.querySelector('[role="link"]');
const button = win.document.querySelector("[data-button]");

if (!button) {
throw new Error("Button not found");
}

frame.click();
button.dispatchEvent(new KeyboardEvent("keypress", { keyCode: 32 }));
Expand Down Expand Up @@ -109,7 +113,11 @@ for (const flow of ["popup", "iframe"]) {

// $FlowFixMe
const win = frame.contentWindow;
const button = win.document.querySelector('[role="link"]');
const button = win.document.querySelector("[data-button]");

if (!button) {
throw new Error("Button not found");
}

frame.click();
button.dispatchEvent(new KeyboardEvent("keypress", { keyCode: 13 }));
Expand Down