Skip to content
This repository has been archived by the owner on Feb 3, 2022. It is now read-only.

Commit

Permalink
Hot patch support for aria role textbox on password fields
Browse files Browse the repository at this point in the history
This commit closes #13 for now but #15 is meant to track
if this is the rigth approach.
  • Loading branch information
jschfflr committed Jul 10, 2020
1 parent c95f078 commit 150e764
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/recorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ export default async (url: string) => {

let script = readFileSync(path.join(__dirname, '../lib/inject.js'), { encoding: 'utf-8' })
script = script.replace(`var childNodes = [];`, `var childNodes = Array.from(node.shadowRoot?.childNodes || []).filter(n => !getOwner(n) && !isHidden(n))`);
// Todo(https://github.com/puppeteer/recorder/issues/15): Check if this is the right approach
script = script.replace(`'input[type="text"]:not([list])',`, `'input[type="text"]:not([list])',\n'input[type="password"]:not([list])',`);
page.evaluateOnNewDocument(script);

// Setup puppeteer
Expand Down
2 changes: 2 additions & 0 deletions src/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ declare const __dirname;
let aria = fs.readFileSync(path.join(__dirname, '../node_modules/aria-api/dist/aria.js'), { encoding: 'utf8' });

aria = aria.replace(`var childNodes = [];`, `var childNodes = Array.from(node.shadowRoot?.childNodes || []).filter(n => !getOwner(n) && !isHidden(n))`);
// Todo(https://github.com/puppeteer/recorder/issues/15): Check if this is the right approach
aria = aria.replace(`'input[type="text"]:not([list])',`, `'input[type="text"]:not([list])',\n'input[type="password"]:not([list])',`);

const ariaSelectorEngine = new Function('element', 'selector', `
// Inject the aria library in case it has not been loaded yet
Expand Down

0 comments on commit 150e764

Please sign in to comment.