Skip to content

Commit dd55a72

Browse files
authored
fix: cursor not changing to pointer on button hover (@nadalaba) (monkeytypegame#6801)
<img width="600" height="111" alt="button" src="https://github.com/user-attachments/assets/ec401e00-bc12-4ff3-89c5-c41753b22566" /> - bug was introduced in [monkeytypegame#6651](monkeytypegame#6651) by changing the inline style `cursor` to `default` when focus mode is disabled instead of removing the `cursor: none` inline style. - add a `.clickable` class to clickable banners/PSAs instead of relying on `cursor: pointer` inline style which may be cleared by `.css("cursor", "")` in the previous commit. - make the test for clickable banners/PSAs case insensitive and allow `<a>` elements in the test.
1 parent d8fd641 commit dd55a72

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

frontend/src/styles/banners.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
color: var(--bg-color);
1010
justify-content: center;
1111

12+
&.clickable {
13+
cursor: pointer;
14+
}
15+
1216
&.withImage {
1317
.lefticon {
1418
display: none;

frontend/src/ts/elements/notifications.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,11 @@ class Notification {
193193
});
194194
}
195195
// NOTE: This need to be changed if the update banner text is changed
196-
if (this.message.includes("please refresh")) {
196+
if (/please (<a.*>)?refresh/i.test(this.message)) {
197197
// add pointer when refresh is needed
198198
$(
199199
`#bannerCenter .banner[id='${this.id}'], #bannerCenter .psa[id='${this.id}']`
200-
).css("cursor", "pointer");
200+
).addClass("clickable");
201201
// refresh on clicking banner
202202
$(
203203
`#bannerCenter .banner[id='${this.id}'], #bannerCenter .psa[id='${this.id}']`

frontend/src/ts/test/focus.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ export function set(foc: boolean, withCursor = false): void {
3636
Caret.startAnimation();
3737
$("header").removeClass("focus");
3838
$("footer").removeClass("focus");
39-
$("body").css("cursor", "default");
40-
$("button").css("cursor", "default");
41-
$("a").css("cursor", "default");
39+
$("body").css("cursor", "");
40+
$("button").css("cursor", "");
41+
$("a").css("cursor", "");
4242
$("main").removeClass("focus");
4343
$("#bannerCenter").removeClass("focus");
4444
$("#notificationCenter").removeClass("focus");

0 commit comments

Comments
 (0)