Skip to content

fix(checks/unsupportedrole): support unsupported dpub and fallback roles, add role to message#3395

Merged
straker merged 53 commits intodequelabs:developfrom
dan-tripp:issue3282
Feb 28, 2022
Merged

fix(checks/unsupportedrole): support unsupported dpub and fallback roles, add role to message#3395
straker merged 53 commits intodequelabs:developfrom
dan-tripp:issue3282

Conversation

@dan-tripp
Copy link
Copy Markdown
Contributor

fix(rules): unsupportedrole check bugs

Closes issue #3282

dan-tripp and others added 30 commits August 19, 2021 21:17
Make `internal-link-present-evaluate` work with virtualNode rather than actualNode.

Closes issue dequelabs#2466
This reverts commit 428e015, reversing
changes made to 9f996bc.
This reverts commit 9f996bc.
@dan-tripp dan-tripp requested a review from a team as a code owner February 21, 2022 23:41
Copy link
Copy Markdown
Contributor

@straker straker left a comment

Choose a reason for hiding this comment

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

Thanks for the pr. Overall it looks good, the only request I have is that we'll want to check the checkContext._data to ensure that the role is set (since we weren't setting it before).

So for tests that return true, we'll check that the role is set:

assert.deepEqual(checkContext._data, [role]);

and for tests that return false, we'll want to check that it's null

assert.isNull(checkContext._data);

See https://github.com/dequelabs/axe-core/blob/develop/test/checks/aria/deprecatedrole.js for examples of doing this.

@dan-tripp
Copy link
Copy Markdown
Contributor Author

That makes sense. I like axe-core's test philosophy. Does my latest push reflect what you have in mind?

Copy link
Copy Markdown
Contributor

@straker straker left a comment

Choose a reason for hiding this comment

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

Yep! Looks great.

Approved for security.

@straker straker changed the title fix(rules): unsupportedrole check bugs fix(checks/unsupportedrole): support unsupported dpub and fallback roles, add role to message Feb 28, 2022
@straker straker merged commit 3c0f10f into dequelabs:develop Feb 28, 2022
@dan-tripp
Copy link
Copy Markdown
Contributor Author

Nice. Thanks again for the guidance.

rafaelpaniago1 added a commit to masganem/axe-core-mes-20252 that referenced this pull request Nov 7, 2025
Corrige três problemas no check 'unsupportedrole':

1. Valor do role não sendo adicionado ao data
   - Adiciona this.data(role) quando role é não suportado
   - Permite que mensagem exiba o role específico

2. Roles dpub não reconhecidos
   - Adiciona opção { dpub: true } ao chamar getRole()
   - Agora detecta roles como 'doc-abstract', 'doc-chapter', etc.

3. Fallback roles não suportados
   - Adiciona opção { fallback: true } ao chamar getRole()
   - Permite detecção em casos como role='unsupported alert'

Arquivos modificados:
- lib/checks/aria/unsupportedrole-evaluate.js
  * Adiciona { dpub: true, fallback: true } ao getRole()
  * Usa this.data() para passar role para mensagem

- lib/checks/aria/unsupportedrole.json
  * Corrige template de ${data.values} para ${data}

- test/checks/aria/unsupportedrole.js
  * Usa MockCheckContext para verificar _data
  * Adiciona testes para dpub roles
  * Adiciona testes para fallback roles
  * Verifica que data é setado corretamente

Comparação com PR oficial dequelabs#3395:
- Similaridade: 99.8%
- Diferenças: Apenas espaçamento (LLM usa linha antes do if)
- Lógica: 100% idêntica
- Testes: 100% idênticos
- Mensagens: 100% idênticas

Issue: dequelabs#3282
PR Oficial: dequelabs#3395

Análise detalhada em: ANALISE-ISSUE-3282.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants