Skip to content

Commit

Permalink
Fix tab input value updating for BS4 dropdowns (#3412)
Browse files Browse the repository at this point in the history
* Fix tab input value updating for BS4 dropdowns

* Add comments

* yarn build (GitHub Actions)

* Better comment

* yarn lint (GitHub Actions)

* yarn build (GitHub Actions)

Co-authored-by: Barret Schloerke <[email protected]>
Co-authored-by: schloerke <[email protected]>
Co-authored-by: cpsievert <[email protected]>
  • Loading branch information
4 people authored Jun 2, 2021
1 parent 871b1ba commit dcca77c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
6 changes: 3 additions & 3 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.

6 changes: 4 additions & 2 deletions srcts/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5958,10 +5958,11 @@ function main(): void {
},
getValue: function (el) {
// prettier-ignore
// The BS4+ selectors may not work as is for dropdowns within dropdowns, but BS3+ dropped support for those anyway
let anchor = isBS3()
? $(el).find("li:not(.dropdown).active > a")
: $(el).find(
".nav-link:not(.dropdown-toggle).active, .dropdown-menu > .dropdown-item.active"
".nav-link:not(.dropdown-toggle).active, .dropdown-menu .dropdown-item.active"
);

if (anchor.length === 1) return this._getTabName(anchor);
Expand All @@ -5974,10 +5975,11 @@ function main(): void {

if (value) {
// prettier-ignore
// The BS4+ selectors may not work as is for dropdowns within dropdowns, but BS3+ dropped support for those anyway
let anchors = isBS3()
? $(el).find("li:not(.dropdown) > a")
: $(el).find(
".nav-link:not(.dropdown-toggle), .dropdown-menu > .dropdown-item"
".nav-link:not(.dropdown-toggle), .dropdown-menu .dropdown-item"
);

anchors.each(function () {
Expand Down

0 comments on commit dcca77c

Please sign in to comment.