fix(dropdown): Add support for aria-disabled items to dropdowns#130
Merged
mshriver merged 1 commit intoJul 21, 2026
Merged
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideTreat PatternFly dropdown menu items with aria-disabled="true" as disabled, and extend tests to cover aria-disabled behavior for both enablement checks and selection exceptions. Sequence diagram for Dropdown.item_enabled aria-disabled handlingsequenceDiagram
participant Test as Test_dropdown
participant Dropdown as Dropdown
participant Browser as Browser
participant Element as MenuItem
Test->>Dropdown: item_enabled(item, close=True)
Dropdown->>Element: item_from_locator(item)
alt Element is input
Dropdown->>Element: is_enabled()
Dropdown-->>Test: is_el_enabled = Element.is_enabled()
else Element is not input
Dropdown->>Browser: classes(Element)
Browser-->>Dropdown: class_list
Dropdown->>Browser: get_attribute(aria-disabled, Element)
Browser-->>Dropdown: aria_disabled_value
Dropdown-->>Test: is_el_enabled = "pf-m-disabled" not in class_list and aria_disabled_value != "true"
end
Dropdown->>Dropdown: close() when close=True
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- Consider extracting the disabled-state logic (CSS class and aria-disabled checks) into a dedicated helper method to avoid duplication and make future changes to the disabled criteria easier to maintain.
- The comparison against the string 'true' for aria-disabled is very specific; if PatternFly or the DOM ever uses other truthy values (e.g., 'True', '1'), you may want to normalize or broaden the check to avoid subtle regressions.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider extracting the disabled-state logic (CSS class and aria-disabled checks) into a dedicated helper method to avoid duplication and make future changes to the disabled criteria easier to maintain.
- The comparison against the string 'true' for aria-disabled is very specific; if PatternFly or the DOM ever uses other truthy values (e.g., 'True', '1'), you may want to normalize or broaden the check to avoid subtle regressions.
## Individual Comments
### Comment 1
<location path="src/widgetastic_patternfly5/components/menus/dropdown.py" line_range="169-173" />
<code_context>
- is_el_enabled = "pf-m-disabled" not in self.browser.classes(el)
+ is_el_enabled = (
+ "pf-m-disabled" not in self.browser.classes(el)
+ and self.browser.get_attribute("aria-disabled", el) != "true"
+ )
</code_context>
<issue_to_address>
**suggestion:** Consider handling case variations for `aria-disabled` values.
`get_attribute("aria-disabled")` may return values with different casing or even non-string types, depending on the driver. Converting the result to a string and lowercasing it before comparison (e.g. `str(...).lower() == "true"`) will make the check resilient to these variations.
```suggestion
else:
aria_disabled = self.browser.get_attribute("aria-disabled", el)
is_el_enabled = (
"pf-m-disabled" not in self.browser.classes(el)
and str(aria_disabled).lower() != "true"
)
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Contributor
Author
|
Failures in the pipelines seem un-related: |
Collaborator
agreed, I need to get this in. |
hugohezel
force-pushed
the
hhezel/dropdown_support_aria_disabled
branch
from
July 21, 2026 11:40
dbc07a2 to
5b92a32
Compare
mshriver
approved these changes
Jul 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make
Dropdown.item_enabled()to treat PatternFly menu links witharia-disabled="true"as disabled. PatternFly's Menu docs document bothisDisabledandisAriaDisabledas supportedMenuItemstates.https://www.patternfly.org/components/menus/menu/#basic-menus
A concrete example of

aria-disableditem can currently be seen on the/insights/remediationspage: