posit-dev / posit-dev/py-shiny

`ui.page_navbar()` and `ui.navset_*()` should give better error messages for non-nav-panel children

Open
#896 0 comments 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.