Skip to content

Conversation

karangattu
Copy link
Collaborator

@karangattu karangattu commented Aug 21, 2025

This pull request enhances navigation handling for dropdown menus in the navigation panel and adds comprehensive Playwright tests for these scenarios. The most important changes include improving the logic for clicking navigation items inside dropdowns and introducing new test applications and test cases to ensure correct behavior for both pill and underline navigation sets.

Navigation logic improvements:

  • Improved the click method in shiny/playwright/controller/_navs.py to detect when a navigation panel is inside a closed dropdown menu and automatically open the dropdown before clicking the target item. This ensures reliable navigation interaction in dropdown scenarios.

Testing enhancements:

  • Added a new test application app-express.py under tests/playwright/shiny/components/nav/navset_menu/ to provide express navigation sets with both pill and underline styles, including dropdown menus and controls.
  • Created a new test file test_app.py in the same directory, introducing parameterized Playwright tests that verify navigation between panels (including those inside dropdowns) for both navset_pill and navset_underline types.

Update NavPanel.click to first open the dropdown if the nav panel is inside a closed dropdown menu. This ensures the nav panel is interactable before attempting to click it.
Introduces an example Shiny Express app using navset_pill and navset_underline with nav_menu, and adds Playwright-based tests to verify navigation between panels. This enhances test coverage for navigation UI components.
Documented the addition of support for selecting menu items in Navset controllers to improve dropdown navigation test coverage.
Replaces the use of the | operator with Union in the type annotation for nav_factory in test_navset_menu for improved compatibility and clarity.
Moved 'from typing import Union' to the top and removed a redundant import statement. Also removed an unnecessary docstring in the test function.
@karangattu karangattu requested a review from schloerke August 22, 2025 01:32
Copy link
Collaborator

@schloerke schloerke left a comment

Choose a reason for hiding this comment

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

Thank you!

@schloerke schloerke changed the title fix(test): Add ability to select navmenu controllers fix(test): Add ability to select ui.nav_menu controllers Aug 28, 2025
@schloerke schloerke merged commit a380aff into main Aug 28, 2025
191 of 193 checks passed
@schloerke schloerke deleted the add-ability-to-select-navmenu-controllers branch August 28, 2025 18:00
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