@@ -30,54 +30,42 @@ import { Icon as NumberedListIcon } from "../../../../../../res/img/element-icon
30
30
import { Icon as CodeBlockIcon } from "../../../../../../res/img/element-icons/room/composer/code_block.svg" ;
31
31
import { Icon as IndentIcon } from "../../../../../../res/img/element-icons/room/composer/indent_increase.svg" ;
32
32
import { Icon as UnIndentIcon } from "../../../../../../res/img/element-icons/room/composer/indent_decrease.svg" ;
33
- import AccessibleTooltipButton from "../../../elements/AccessibleTooltipButton" ;
34
- import { Alignment } from "../../../elements/Tooltip" ;
35
- import { KeyboardShortcut } from "../../../settings/KeyboardShortcut" ;
36
- import { KeyCombo } from "../../../../../KeyBindingsManager" ;
37
33
import { _t } from "../../../../../languageHandler" ;
38
- import { ButtonEvent } from "../../../elements/AccessibleButton" ;
34
+ import AccessibleButton , { ButtonEvent } from "../../../elements/AccessibleButton" ;
39
35
import { openLinkModal } from "./LinkModal" ;
40
36
import { useComposerContext } from "../ComposerContext" ;
37
+ import { KeyboardShortcut } from "../../../settings/KeyboardShortcut" ;
38
+ import { KeyCombo } from "../../../../../KeyBindingsManager" ;
41
39
42
- interface TooltipProps {
43
- label : string ;
44
- keyCombo ?: KeyCombo ;
45
- }
46
-
47
- function Tooltip ( { label, keyCombo } : TooltipProps ) : JSX . Element {
48
- return (
49
- < div className = "mx_FormattingButtons_Tooltip" >
50
- { label }
51
- { keyCombo && (
52
- < KeyboardShortcut value = { keyCombo } className = "mx_FormattingButtons_Tooltip_KeyboardShortcut" />
53
- ) }
54
- </ div >
55
- ) ;
56
- }
57
-
58
- interface ButtonProps extends TooltipProps {
40
+ interface ButtonProps {
59
41
icon : ReactNode ;
60
42
actionState : ActionState ;
61
43
onClick : MouseEventHandler < HTMLButtonElement > ;
44
+ label : string ;
45
+ keyCombo ?: KeyCombo ;
62
46
}
63
47
64
48
function Button ( { label, keyCombo, onClick, actionState, icon } : ButtonProps ) : JSX . Element {
65
49
return (
66
- < AccessibleTooltipButton
50
+ < AccessibleButton
67
51
element = "button"
68
52
onClick = { onClick as ( e : ButtonEvent ) => void }
69
- title = { label }
53
+ aria-label = { label }
70
54
className = { classNames ( "mx_FormattingButtons_Button" , {
71
55
mx_FormattingButtons_active : actionState === "reversed" ,
72
56
mx_FormattingButtons_Button_hover : actionState === "enabled" ,
73
57
mx_FormattingButtons_disabled : actionState === "disabled" ,
74
58
} ) }
75
- tooltip = { keyCombo && < Tooltip label = { label } keyCombo = { keyCombo } /> }
76
- forceHide = { actionState === "disabled" }
77
- alignment = { Alignment . Top }
59
+ title = { actionState === "disabled" ? undefined : label }
60
+ caption = {
61
+ keyCombo && (
62
+ < KeyboardShortcut value = { keyCombo } className = "mx_FormattingButtons_Tooltip_KeyboardShortcut" />
63
+ )
64
+ }
65
+ placement = "top"
78
66
>
79
67
{ icon }
80
- </ AccessibleTooltipButton >
68
+ </ AccessibleButton >
81
69
) ;
82
70
}
83
71
0 commit comments