File tree Expand file tree Collapse file tree 2 files changed +8
-17
lines changed
src/renderer/components/ft-icon-button Expand file tree Collapse file tree 2 files changed +8
-17
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,6 @@ export default defineComponent({
69
69
data : function ( ) {
70
70
return {
71
71
dropdownShown : false ,
72
- mouseDownOnIcon : false ,
73
72
useModal : false
74
73
}
75
74
} ,
@@ -111,24 +110,15 @@ export default defineComponent({
111
110
}
112
111
} ,
113
112
114
- handleIconMouseDown : function ( ) {
115
- if ( this . disabled ) { return }
116
- if ( this . dropdownShown ) {
117
- this . mouseDownOnIcon = true
118
- }
119
- } ,
120
-
121
113
handleDropdownFocusOut : function ( ) {
122
- if ( this . mouseDownOnIcon ) {
123
- this . mouseDownOnIcon = false
124
- } else if ( ! this . $refs . dropdown . matches ( ':focus-within' ) ) {
114
+ if ( this . dropdownShown && ! this . $refs . ftIconButton . matches ( ':focus-within' ) ) {
125
115
this . dropdownShown = false
126
116
}
127
117
} ,
128
118
129
119
handleDropdownEscape : function ( ) {
130
- this . $refs . iconButton . focus ( )
131
- // handleDropdownFocusOut will hide the dropdown for us
120
+ this . dropdownShown = false
121
+ this . $refs . ftIconButton . firstElementChild . focus ( )
132
122
} ,
133
123
134
124
handleDropdownClick : function ( { url, index } ) {
Original file line number Diff line number Diff line change 1
1
<template >
2
- <div class =" ftIconButton" >
2
+ <div
3
+ ref =" ftIconButton"
4
+ class =" ftIconButton"
5
+ @focusout =" handleDropdownFocusOut"
6
+ >
3
7
<font-awesome-icon
4
- ref =" iconButton"
5
8
class =" iconButton"
6
9
:title =" title"
7
10
:icon =" icon"
19
22
:aria-disabled =" disabled"
20
23
:aria-expanded =" dropdownShown"
21
24
@click =" handleIconClick"
22
- @mousedown =" handleIconMouseDown"
23
25
@keydown.enter.prevent =" handleIconClick"
24
26
@keydown.space.prevent =" handleIconClick"
25
27
/>
67
69
bottom: dropdownPositionY === 'bottom',
68
70
top: dropdownPositionY === 'top'
69
71
}"
70
- @focusout =" handleDropdownFocusOut"
71
72
@keydown.esc.stop =" handleDropdownEscape"
72
73
>
73
74
<slot >
You can’t perform that action at this time.
0 commit comments