Skip to content

chore: refactor away from looking at role attribute #4756

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

straker
Copy link
Contributor

@straker straker commented Apr 22, 2025

This work is in preparation to support fallback roles. Any part of the code that used .getAttribute('role') or .attr('role') was migrated to use getEplicitRole() instead. There are a few places that still look at the role attribute directly, but those cases are validating the attributes value for different things so it's a valid use case (e.g. looking for abstract roles, invalid roles, fallback roles, unallowed roles, etc.).

Also migrates some of the older test code to use arrow functions and const rather than var (which is a tech debt strategy to slowly update the code as we touch the files).

Part of #3768

@straker straker requested a review from a team as a code owner April 22, 2025 20:28
const role = cell.getAttribute('role');
if (isValidRole(role)) {
const role = getExplicitRole(cell);
if (role) {
Copy link
Contributor Author

@straker straker Apr 22, 2025

Choose a reason for hiding this comment

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

getExplicitRole already validates the role if it returns, otherwise it returns null for an invalid role. So we don't have to validate it again.

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.

1 participant