Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove !important rule inline in searchInput() #637

Closed
mojohansen opened this issue Sep 25, 2023 · 1 comment
Closed

Remove !important rule inline in searchInput() #637

mojohansen opened this issue Sep 25, 2023 · 1 comment

Comments

@mojohansen
Copy link

mojohansen commented Sep 25, 2023

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!

@pvictor
Copy link
Member

pvictor commented Jan 3, 2024

Indeed I see no good reason for that, nor the need of those rules. I think we can remove them entirely.

@pvictor pvictor closed this as completed Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants