Skip to content

Commit

Permalink
Make ensureTabsetHasVisibleTab() is aware of BS4+ markup (#3349)
Browse files Browse the repository at this point in the history
* Close rstudio/shinycoreci-apps#126: Make ensureTabsetHasVisibleTab() aware of BS4+ markup

* yarn build (GitHub Actions)

* Update srcts/src/main.ts

* yarn lint (GitHub Actions)

* yarn build (GitHub Actions)

Co-authored-by: cpsievert <[email protected]>
  • Loading branch information
cpsievert and cpsievert authored Mar 26, 2021
1 parent e29d92c commit 5c919ae
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions inst/www/shared/shiny.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions inst/www/shared/shiny.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inst/www/shared/shiny.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions inst/www/shared/shiny.min.js.map

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions srcts/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1480,13 +1480,16 @@ function main(): void {

// If the given tabset has no active tabs, select the first one
function ensureTabsetHasVisibleTab($tabset) {
if ($tabset.find("li.active").not(".dropdown").length === 0) {
const inputBinding = $tabset.data("shiny-input-binding");

// Use the getValue() method to avoid duplicating the CSS selector
// for querying the DOM for the currently active tab
if (!inputBinding.getValue($tabset)) {
// Note: destTabValue may be null. We still want to proceed
// through the below logic and setValue so that the input
// value for the tabset gets updated (i.e. input$tabsetId
// should be null if there are no tabs).
const destTabValue = getFirstTab($tabset);
const inputBinding = $tabset.data("shiny-input-binding");
const evt = jQuery.Event("shiny:updateinput");

evt.binding = inputBinding;
Expand Down

0 comments on commit 5c919ae

Please sign in to comment.