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.
<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> |
Thanks Satheesh,
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.