Repository navigation
Fix primitive progress ARIA values #7438
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
Merged
masenf
merged 7 commits into
reflex-dev:main
from
harsh21234i:fix/7431-primitive-progress-aria
Oct 9, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b1bde01
Fix primitive progress ARIA values
harsh21234i 404850b
Add browser coverage for primitive progress ARIA
harsh21234i 1236458
Test primitive progress ARIA in prod mode
harsh21234i 620555b
Document progress test fixture yield
harsh21234i 2f8f785
chore: update progress stub hash
harsh21234i 3441000
chore: preserve generated hash file formatting
harsh21234i 36b603a
Narrow progress components in unit test
harsh21234i File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Forward progress values to the Radix Root so its state and ARIA attributes reflect the displayed progress. |
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
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
67 changes: 67 additions & 0 deletions
67
tests/integration/tests_playwright/test_radix_components.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| """Playwright integration tests for Radix primitive components.""" | ||
|
|
||
| from collections.abc import Generator | ||
|
|
||
| import pytest | ||
| from playwright.sync_api import Page, expect | ||
|
|
||
| from reflex.testing import AppHarness | ||
|
|
||
|
|
||
| def ProgressApp(): | ||
| """App with a stateful primitive Progress component.""" | ||
| from reflex_components_radix.primitives.progress import progress | ||
|
|
||
| import reflex as rx | ||
|
|
||
| class ProgressState(rx.State): | ||
| value: int = 25 | ||
|
|
||
| @rx.event | ||
| def advance(self): | ||
| self.value = 50 | ||
|
|
||
| app = rx.App() | ||
|
|
||
| @app.add_page | ||
| def index(): | ||
| return rx.vstack( | ||
| progress(value=ProgressState.value, max=100, id="progress"), | ||
| rx.button("Advance", on_click=ProgressState.advance), | ||
| ) | ||
|
|
||
|
|
||
| @pytest.fixture(scope="module") | ||
| def progress_app( | ||
| app_harness_env: type[AppHarness], tmp_path_factory: pytest.TempPathFactory | ||
| ) -> Generator[AppHarness, None, None]: | ||
| """Run the primitive Progress app in dev and prod modes. | ||
|
|
||
| Args: | ||
| app_harness_env: AppHarness class for dev or production mode. | ||
| tmp_path_factory: Pytest fixture for creating temporary directories. | ||
|
|
||
| Yields: | ||
| The running app harness. | ||
|
|
||
| """ | ||
| with app_harness_env.create( | ||
| root=tmp_path_factory.mktemp("radix_progress"), | ||
| app_source=ProgressApp, | ||
| ) as harness: | ||
| assert harness.app_instance is not None, "app is not running" | ||
| yield harness | ||
|
|
||
|
|
||
| def test_progress_aria_value_updates(progress_app: AppHarness, page: Page) -> None: | ||
| """The Root exposes and updates its current value through ARIA.""" | ||
| assert progress_app.frontend_url is not None | ||
|
|
||
| page.goto(progress_app.frontend_url) | ||
| progressbar = page.get_by_role("progressbar") | ||
| expect(progressbar).to_have_attribute("id", "progress") | ||
| expect(progressbar).to_have_attribute("aria-valuenow", "25") | ||
| expect(progressbar).to_have_attribute("aria-valuemax", "100") | ||
|
|
||
| page.get_by_role("button", name="Advance").click() | ||
| expect(progressbar).to_have_attribute("aria-valuenow", "50") |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| """Tests for the Radix primitive progress wrapper.""" | ||
|
|
||
| import pytest | ||
| from reflex_base.vars.base import Var | ||
| from reflex_components_radix.primitives.progress import ( | ||
| ProgressIndicator, | ||
| ProgressRoot, | ||
| progress, | ||
| ) | ||
|
|
||
|
|
||
| @pytest.mark.parametrize( | ||
| ("value", "max_value", "expected_value", "expected_max"), | ||
| [ | ||
| (25, 200, "25", "200"), | ||
| ( | ||
| Var(_js_expr="progress_state.amount", _var_type=int), | ||
| Var(_js_expr="progress_state.total", _var_type=int), | ||
| "progress_state.amount", | ||
| "progress_state.total", | ||
| ), | ||
| ], | ||
| ) | ||
| def test_progress_forwards_numeric_props_to_root_and_indicator( | ||
| value: int | Var[int], | ||
| max_value: int | Var[int], | ||
| expected_value: str, | ||
| expected_max: str, | ||
| ) -> None: | ||
| """The Root exposes numeric progress while the Indicator uses it for width.""" | ||
| component = progress(value=value, max=max_value) | ||
|
|
||
| assert isinstance(component, ProgressRoot) | ||
| indicator = component.children[0] | ||
| assert isinstance(indicator, ProgressIndicator) | ||
|
|
||
| for part in (component, indicator): | ||
| props = part._render().props | ||
| assert props["value"]._js_expr == expected_value | ||
| assert props["max"]._js_expr == expected_max | ||
|
|
||
|
|
||
| def test_progress_forwards_defaults_to_root_and_indicator() -> None: | ||
| """The default progress state is shared by both primitive parts.""" | ||
| component = progress() | ||
| assert isinstance(component, ProgressRoot) | ||
| indicator = component.children[0] | ||
| assert isinstance(indicator, ProgressIndicator) | ||
|
|
||
| for part in (component, indicator): | ||
| props = part._render().props | ||
| assert props["value"]._js_expr == "0" | ||
| assert props["max"]._js_expr == "100" | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.