posit-dev / posit-dev/py-shiny

UI inputs: Add input's type as a class to the parent div

Open
#267 0 comments 1 reaction 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

This is something I have often wished existed in R-Shiny (@jcheng5 R-shiny finally makes sense, now that we have py-shiny!)

There are many cases where I want to know what type of input I'm dealing with in javascript and we always need to perform a lot of heuristic checks. It would be nice if inputs declared their own type in the parent class. For exapmle, ui.input_numeric("x", None,5) is currently

<div class="form-group shiny-input-container">
  <label class="control-label shiny-label-null" id="x-label" for="x"></label>
  <input id="x" type="number" class="form-control" value="5"/>
</div>

It could be

<div class="form-group shiny-input-container shiny-input-numeric">
  <label class="control-label shiny-label-null" id="x-label" for="x"></label>
  <input id="x" type="number" class="form-control" value="5"/>
</div>

(Stolen from https://github.com/rstudio/shiny/issues/1286)

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

No files or tests are named in the issue. Start by locating the code that renders Shiny input parent divs, then trace how input types are represented across the input components. Done means the relevant parent divs expose consistent type-specific classes, including the numeric example shown, with coverage for the affected inputs.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, javascript, python
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.