shinyMobile
shinyMobile copied to clipboard
Tabs (`f7Tab`) can create duplicate IDs which in turn break the page
Because of the way IDs are being assigned to individual tabs (removing punctuation and whitespace from the tabName argument) , it's possible for different tabs to result in the same ID. When this happens, only the first tab appears on the page, and the other tabs are broken. The documentation for the argument only says that it's an ID so it must be unique, so two tabs with the names "ab" and "a. b" should be ok, but that causes issues.
I'll use what I wrote here instead:
validate_tabName <- function(tabName) {
forbidden <- "(?!_)[[:punct:]]"
wrong_selector <- grepl(forbidden, tabName, perl = TRUE)
if (wrong_selector) {
stop(
paste(
"Please do not use punctuation characters in tabNames.
This might cause JavaScript issues."
)
)
}
}
validate_tabName("plop")
validate_tabName("test%"))
It need to account for whistespace as well