diff --git a/R/insert-tab.R b/R/insert-tab.R index 1a7563f7a1..c8e7a0cef8 100644 --- a/R/insert-tab.R +++ b/R/insert-tab.R @@ -137,14 +137,48 @@ insertTab <- function(inputId, tab, target, #' @export prependTab <- function(inputId, tab, select = FALSE, menuName = NULL, session = getDefaultReactiveDomain()) { - bslib::nav_prepend(inputId, tab, select, menuName, session) + force(select) + force(menuName) + inputId <- session$ns(inputId) + + item <- buildTabItem("id", "tsid", TRUE, divTag = tab, + textFilter = if (is.character(tab)) navbarMenuTextFilter else NULL) + + callback <- function() { + session$sendInsertTab( + inputId = inputId, + liTag = processDeps(item$liTag, session), + divTag = processDeps(item$divTag, session), + menuName = menuName, + target = NULL, + position = "after", + select = select) + } + session$onFlush(callback, once = TRUE) } #' @rdname insertTab #' @export appendTab <- function(inputId, tab, select = FALSE, menuName = NULL, session = getDefaultReactiveDomain()) { - bslib::nav_append(inputId, tab, select, menuName, session) + force(select) + force(menuName) + inputId <- session$ns(inputId) + + item <- buildTabItem("id", "tsid", TRUE, divTag = tab, + textFilter = if (is.character(tab)) navbarMenuTextFilter else NULL) + + callback <- function() { + session$sendInsertTab( + inputId = inputId, + liTag = processDeps(item$liTag, session), + divTag = processDeps(item$divTag, session), + menuName = menuName, + target = NULL, + position = "before", + select = select) + } + session$onFlush(callback, once = TRUE) } #' @rdname insertTab