There are 2 updates, 1 comment.
 
 
XWiki Platform / cid:jira-generated-image-avatar-98110863-e59b-4c9a-a69a-2c0fb13a378e XWIKI-20436 Open

bootstrap .btn:hover can result in white text on white background for buttons

 
View issue   ยท   Add comment
 

2 updates

 
cid:jira-generated-image-avatar-52f1fa43-2c89-4185-8a41-3069aa632acc Changes by Charpentier Lucas on 16/Oct/25 10:36
 
Attachment: screenshot-1.png
Assignee: Charpentier Lucas
 
 

1 comment

 
cid:jira-generated-image-avatar-52f1fa43-2c89-4185-8a41-3069aa632acc Charpentier Lucas on 16/Oct/25 10:40
 

On one hand, bootstrap buttons without a variant (so with only class=".btn") do not have a text color set, they just inherit it.
On the other hand however, bootstrap buttons without a variant have a color set on hover and focus states: @btn-default-color (for some reason)

As far as I understand, bootstrap buttons are supposed to have a variant to be styled properly.
This is done this way because bootstrap (and we) do not want to support five extra variables for button-hover-color .
Here is the code reference.

https://github.com/xwiki/xwiki-platform/blob/de55262bf6fcdd1ab49cae3e0c6e791d01f0412b/xwiki-platform-core/xwiki-platform-bootstrap/src/main/less/buttons.less#L34-L39

https://getbootstrap.com/docs/3.4/javascript/#buttons
https://getbootstrap.com/docs/3.4/css/#buttons-tags

The official doc of bootstrap 3.4 does not explain how to use the classes exactly (i.e. it doesn't rule out using `.btn` by itself), but all the examples always also contain a `.btn-<something>` class.

As far as I understand, this is a case of the user needing a custom style for the button (different from the 5 that are supported via bootstrap classes). IMO it's alright to expect the user to also custom style the hover effect OR not use the `.btn` class to get some styles OR also use the `.btn-default` class and add upon it.

_thumb_44274.png

On this screenshot, I used the Iceberg default theme, with an updated `@btn-default-bg` and `@btn-default-color`.
We can see that those button look similar to btn-default, but they do not follow their style. It's an issue in itself because a user would expect these buttons to change when updating their theme.

The core issue here for XS code is that the button styles are hard-coded.

In order to fix this, small style improvements on this example are needed.