File tree 1 file changed +12
-2
lines changed
1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -193,14 +193,17 @@ for (i = 0; i < slimDropdownElements.length; i++) {
193
193
var buttonsInChat = document . querySelectorAll ( "#chat-tab:not(.old-ui) #chat-buttons button" ) ;
194
194
var button = document . getElementById ( "hover-element-button" ) ;
195
195
var menu = document . getElementById ( "hover-menu" ) ;
196
+ var istouchscreen = ( navigator . maxTouchPoints > 0 ) || "ontouchstart" in document . documentElement ;
196
197
197
198
function showMenu ( ) {
198
199
menu . style . display = "flex" ; // Show the menu
199
200
}
200
201
201
202
function hideMenu ( ) {
202
203
menu . style . display = "none" ; // Hide the menu
203
- document . querySelector ( "#chat-input textarea" ) . focus ( ) ;
204
+ if ( ! istouchscreen ) {
205
+ document . querySelector ( "#chat-input textarea" ) . focus ( ) ; // Focus on the chat input
206
+ }
204
207
}
205
208
206
209
if ( buttonsInChat . length > 0 ) {
@@ -235,11 +238,18 @@ function isMouseOverButtonOrMenu() {
235
238
}
236
239
237
240
button . addEventListener ( "mouseenter" , function ( ) {
238
- showMenu ( ) ;
241
+ if ( ! istouchscreen ) {
242
+ showMenu ( ) ;
243
+ }
239
244
} ) ;
240
245
241
246
button . addEventListener ( "click" , function ( ) {
247
+ if ( menu . style . display === "flex" ) {
248
+ hideMenu ( ) ;
249
+ }
250
+ else {
242
251
showMenu ( ) ;
252
+ }
243
253
} ) ;
244
254
245
255
// Add event listener for mouseleave on the button
You can’t perform that action at this time.
0 commit comments