Blazor SfToolbar items remain selected after click with bootstrap5.css
Hi,
We are using the SfToolbar with the bootstrap5.css theme.
After you click a default ToolbarItem, it remains selected, as shown in the attached image.
For example, if the OnClick event launches a dialog, after the dialog is hidden the ToolbarItem is displayed in hover/toggle mode (see image).
This is not standard behavior for a toolbar.
The docs suggest it is possible to customize with .e-toolbar .e-tbar-btn:focus, however:
a) What css do we use for this?
b) How do we set the css such that we can change themes dynamically?
b) Why does it retain focus after a click?
Please advise. Thank you.
|
<SfToolbar CssClass="depress-class">
<ToolbarItems> <ToolbarItem Text="DoNothing" Type="ItemType.Button"></ToolbarItem> </ToolbarItems> </SfToolbar> <style> .e-toolbar.depress-class .e-tbar-btn:focus { background: #f8f9fa; box-shadow: none; border: none; } .e-toolbar.depress-class .e-tbar-btn:focus .e-tbar-btn-text { color: #212529; padding: 4px; } </style> |
Thank you for the response Satheesh.
- The solution suggested works except that it hides the icon. Could you please update to handle icons.
- It would be good if there was an option added to support this behaviour, otherwise dynamically switching to a different theme (e.g. Light->Dark) will be much harder.
|
<SfToolbar CssClass="depress-class"> <ToolbarItems> <ToolbarItem Text="DoNothing" Type="ItemType.Button"></ToolbarItem> </ToolbarItems> </SfToolbar> <style>
.e-toolbar.depress-class .e-tbar-btn:focus { background: #f8f9fa; box-shadow: none; border: none; } .e-toolbar.depress-class .e-tbar-btn:focus .e-tbar-btn-text { color: #212529; padding: 4px; } .e-toolbar.depress-class .e-tbar-btn:focus .e-icons.e-btn-icon { color: #6c757d; padding: 4px; } </style> |
The feature will be included in any of our upcoming releases until then we suggest you to use the previously suggested solution. At the planning stage for every release cycle, we will review all the open features and identify features for implementation based on specific parameters including product vision, technological feasibility, and customer interest and its importance in component. Priority will be given to feature request which has maximum number of votes. So, we request you to keep track of the status through the above feedback link.
Thanks Satheesh,
- That fixes the issue with the icon.
- However, after a button is clicked, that button then does not display the correct hover state, while other buttons do. It looks like that button is disabled.
- Whether you have used any customization styles in toolbar other than we have shared?
- Share a video demo depicting the issue
- Whether the issue reproduced in our previously shared sample?
Please nota that the same behavior occurs in your example. It is only when you focus on another control that the hover behavior returns.
Also, in the video you can see that the button changes size after click.
Thanks!
|
<SfToolbar CssClass="depress-class">
</SfToolbar> <style> .e-toolbar.depress-class .e-tbar-btn:focus { background: #f8f9fa; box-shadow: none; border: none; } .e-toolbar.depress-class .e-tbar-btn:focus .e-tbar-btn-text { color: #212529; padding: 4px; } .e-toolbar.depress-class .e-tbar-btn:focus .e-icons.e-btn-icon { color: #6c757d; } .e-toolbar.depress-class .e-tbar-btn:hover { background: #5c636a; border-color: #6c757d; color: #6c757d; } .e-toolbar.depress-class .e-tbar-btn:hover .e-icons.e-btn-icon, .e-toolbar.depress-class .e-tbar-btn:hover .e-tbar-btn-text { color: #fff; } </style> |
This works now. Many thanks. If this does become a built in option, that would be great.
Regards,
Nevitha
- 11 Replies
- 3 Participants
-
JO John
- Oct 7, 2021 06:36 PM UTC
- Oct 18, 2021 12:33 PM UTC