Skip to content

Remove !important rule inline in searchInput() #637

@mojohansen

Description

@mojohansen

Is there a good reason that the function declaration of searchInput() is made with an inline !important rule for border-radius in the text input box? (Using version 0.8.0)

From the source (shinyWidgets::searchinput):

function (inputId, label = NULL, value = "", placeholder = NULL, 
    btnSearch = NULL, btnReset = NULL, resetValue = "", width = NULL) 
{    value <- shiny::restoreInput(id = inputId, default = value)
    tagSearch <- htmltools::tags$button(class = "btn btn-default btn-addon action-button", 
        id = paste0(inputId, "_search"), type = "button", btnSearch, 
        style = if (is.null(btnSearch)) 
            css(display = "none"))
    tagReset <- htmltools::tags$button(class = "btn btn-default btn-addon action-button", 
        id = paste0(inputId, "_reset"), type = "button", btnReset, 
        style = if (is.null(btnReset)) 
            css(display = "none"))
    css_btn_addon <- paste0(".btn-addon{", "font-size:14.5px;", 
        "margin:0 0 0 0 !important;", "display: inline-block !important;", 
        "}")
    htmltools::tags$div(class = "form-group shiny-input-container", 
        style = css(width = validateCssUnit(width)), label_input(inputId, 
            label), htmltools::tags$div(id = inputId, `data-reset` = !is.null(resetValue), 
            `data-reset-value` = resetValue, class = "input-group search-text", 
            htmltools::tags$input(id = paste0(inputId, "_text"), 
                style = "border-radius: 0.25em 0 0 0.25em !important;", 
                type = "text", class = "form-control", value = value, 
                placeholder = placeholder), markup_search_input_group_button(tagReset, 
                tagSearch, btnSearch, btnReset, theme_func = shiny::getCurrentTheme)), 
        singleton(tags$head(tags$style(css_btn_addon))), html_dependency_input_icons())
}
<bytecode: 0x55938e5daa60>
<environment: namespace:shinyWidgets>

Omitting !important in the parameter: style = "border-radius: 0.25em 0 0 0.25em !important;" would give the user the possibility of overriding that property with some custom css, but maybe I am overlooking something.

Thank you for all your hard work and a great package!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions