-
Notifications
You must be signed in to change notification settings - Fork 65
feat: Add toolbar buttons #1256
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
base: feat/toolbar-epic
Are you sure you want to change the base?
Conversation
Co-authored-by: Garrick Aden-Buie <garrick@adenbuie.com>
…slib into feat/toolbar-container
Co-authored-by: Garrick Aden-Buie <garrick@adenbuie.com>
Co-authored-by: Garrick Aden-Buie <garrick@adenbuie.com>
Co-authored-by: Garrick Aden-Buie <garrick@adenbuie.com>
Co-authored-by: Garrick Aden-Buie <garrick@adenbuie.com>
…into feature/add-buttons
…into feature/add-buttons
Co-authored-by: Garrick Aden-Buie <garrick@adenbuie.com>
| rlang, | ||
| sass (>= 0.4.9) | ||
| sass (>= 0.4.9), | ||
| shiny (>= 1.11.1.9000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, shiny should stay under Suggests. You can just move this line back down to be between rmarkdown and testthat.
| #' A toolbar which can contain buttons, inputs, and other UI elements in a small | ||
| #' form suitable for inclusion in card headers, footers, and other small places. | ||
| #' | ||
| #' @examplesIf rlang::is_interactive() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can just be @examples. We use this pattern when you wouldn't want to run the example unless you're in an interactive session -- like when you create a full Shiny app in the example. Showing a little snippet of HTML is generally safe (IIRC)
| #' toolbar_input_button(id = "see", icon = icon("eye")), | ||
| #' toolbar_input_button(id = "save", icon = icon("save")), | ||
| #' toolbar_input_button(id = "edit", icon = icon("pencil")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seeing this example reminded me that I the current API doesn't do a great job of guiding people to fall into the pit of accessibility success.
It might be better to force people to provide either label or tooltip and then have a separate option like icon_only = TRUE. Then, if label is provided, we'd add an appropriate ARIA attribute. We should also evaluate the accessibility implications of using a tooltip to communicate meaning, maybe we'll end up always requiring label so we can set up the right ARIA attributes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: this would also impact our determination of btn_type in toolbar_input_button()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So right now based on the Mac native voiceover functionality, here's what happens:
If label: reads label
If icon: reads the aria-label which is "icon_name icon" (ex. "calendar icon")
If tooltip: Reads the tooltip, then whatever case of the above applies.
Based on this, I actually think our implementation of tooltip might be more accessible than the non-tooltipped version.
Two potential options I'm thinking of:
- Require label always, set a
show_labeloption to True or False which controls visibility. Label gets set as the aria attribute no matter what. - Require a tooltip or a label, that gets set as the aria attribute.
Thoughts?
| align-items: center; | ||
| align-self: stretch; | ||
| min-height: 2.5rem; | ||
| padding-block: 4px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is likely the right final value, but I think we should see if we can hook this into a Bootstrap CSS variable
Fixes #1248
Adds buttons suitable for inclusion in toolbars.
Buttons:
To-do:
Example with active/disabled button
Before click activate button:
