Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Certain pages result in "Cannot read properties of undefined (reading 'replace')" #691

Open
alberto56 opened this issue Feb 6, 2024 · 4 comments · May be fixed by #698
Open

Certain pages result in "Cannot read properties of undefined (reading 'replace')" #691

alberto56 opened this issue Feb 6, 2024 · 4 comments · May be fixed by #698
Milestone

Comments

@alberto56
Copy link

alberto56 commented Feb 6, 2024

Expected behaviour

pa11y -V
# 7.0.0
pa11y "https://amazon.com"
# shows a11y results
pa11y "http://doctors.mystewardhealthcare.org/user/login"
# shows a11y results

Actual behaviour

pa11y -V
# 7.0.0
pa11y "https://amazon.com"
# shows a11y results
pa11y "http://doctors.mystewardhealthcare.org/user/login"
# shows a11y results
Welcome to Pa11y


  Puppeteer old Headless deprecation warning:
    In the near feature `headless: true` will default to the new Headless mode
    for Chrome instead of the old Headless implementation. For more
    information, please see https://developer.chrome.com/articles/new-headless/.
    Consider opting in early by passing `headless: "new"` to `puppeteer.launch()`
    If you encounter any bugs, please report them to https://github.com/puppeteer/puppeteer/issues/new/choose.

> Running Pa11y on URL http://doctors.mystewardhealthcare.org/user/login

Error: TypeError: Cannot read properties of undefined (reading 'replace')
    at evaluate (evaluate at injectRunners (/app/node_modules/pa11y/lib/pa11y.js:304:20), <anonymous>:32:289130)
    at a (evaluate at injectRunners (/app/node_modules/pa11y/lib/pa11y.js:304:20), <anonymous>:32:289233)
    at b (evaluate at injectRunners (/app/node_modules/pa11y/lib/pa11y.js:304:20), <anonymous>:32:289252)
    at h (evaluate at injectRunners (/app/node_modules/pa11y/lib/pa11y.js:304:20), <anonymous>:32:289113)
    at evaluate (evaluate at injectRunners (/app/node_modules/pa11y/lib/pa11y.js:304:20), <anonymous>:32:289130)
    at #evaluate (/app/node_modules/pa11y/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.js:252:55)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ExecutionContext.evaluate (/app/node_modules/pa11y/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.js:149:16)
    at async runPa11yTest (/app/node_modules/pa11y/lib/pa11y.js:88:18)
    at async /app/node_modules/p-timeout/index.js:50:13

Steps to reproduce

pa11y "http://doctors.mystewardhealthcare.org/user/login"

Environment

    System:
      OS: Linux 6.6 Alpine Linux
      CPU: (10) arm64 unknown
      Memory: 17.41 GB / 19.51 GB
      Shell: 1.36.1 - /bin/ash
    Binaries:
      Node: 21.3.0 - /usr/local/bin/node
      Yarn: 1.22.19 - /usr/local/bin/yarn
      npm: 10.2.4 - /usr/local/bin/npm
    pa11y: 7.0.0
@tobiasberge
Copy link

Hi, I can confirm the same issue (pa11y version 7.0.0 and node v20.10.0). I am using not the CLI but a node script file.

Happens for both runners axe and htmlcs.

For me the issue occurs when an autocomplete attribute is in the document which has the value username.

<input 
  autocomplete="username webauthn"
>

When the username is removed from the attribute the issue is fixed.

@danyalaytekin
Copy link
Member

Thanks for the reports @alberto56 and @tobiasberge. Confirmed locally.

@danyalaytekin
Copy link
Member

danyalaytekin commented Mar 18, 2024

Hey @alberto56 @tobiasberge, we're still investigating, but, in the meantime, if it'll help to unblock you, here's a suggestion by @kussmaul (thanks @kussmaul):

Being explicit about type does allow the test case to pass. Ideally though, yes, Pa11y should process this scenario without collapsing, using any runner.

@tobiasberge
Copy link

Hi @danyalaytekin, thank you for reaching out. 🙂

That sounds like a good workaround, I will try it out. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants