posit-dev / posit-dev/py-shiny
`ui.page_navbar()` and `ui.navset_*()` should give better error messages for non-nav-panel children
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.8k
- Forks
- 135
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 21
Description
from shiny import ui
>>> ui.page_navbar(ui.div())
AttributeError: 'Tag' object has no attribute 'get_value'
>>> ui.page_navbar(ui.nav("first"), ui.div())
AttributeError: 'Tag' object has no attribute 'resolve'
>>> ui.navset_bar(ui.nav("first"), ui.div("bad"), title = "title"))
AttributeError: 'Tag' object has no attribute 'resolve'
The intention in all of the above is to limit the children of page_navbar() and navset_*() to ui.nav_panel() (fka ui.nav()) items, and the error could be clarified.
See #821
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the three examples for ui.page_navbar() and ui.navset_*(), then trace where their children are validated and where the AttributeError is produced. Done means non-nav-panel children produce a clear, intentional error explaining the accepted child type, while valid navigation panels continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100