@@ -15,7 +15,6 @@ limitations under the License.
15
15
*/
16
16
17
17
import React , {
18
- ComponentProps ,
19
18
Dispatch ,
20
19
KeyboardEvent ,
21
20
KeyboardEventHandler ,
@@ -62,7 +61,6 @@ import InfoTooltip from "../views/elements/InfoTooltip";
62
61
import TextWithTooltip from "../views/elements/TextWithTooltip" ;
63
62
import { useStateToggle } from "../../hooks/useStateToggle" ;
64
63
import { getChildOrder } from "../../stores/spaces/SpaceStore" ;
65
- import AccessibleTooltipButton from "../views/elements/AccessibleTooltipButton" ;
66
64
import { Linkify , topicToHtml } from "../../HtmlUtils" ;
67
65
import { useDispatcher } from "../../hooks/useDispatcher" ;
68
66
import { Action } from "../../dispatcher/actions" ;
@@ -75,7 +73,6 @@ import { ViewRoomPayload } from "../../dispatcher/payloads/ViewRoomPayload";
75
73
import { JoinRoomReadyPayload } from "../../dispatcher/payloads/JoinRoomReadyPayload" ;
76
74
import { KeyBindingAction } from "../../accessibility/KeyboardShortcuts" ;
77
75
import { getKeyBindingsManager } from "../../KeyBindingsManager" ;
78
- import { Alignment } from "../views/elements/Tooltip" ;
79
76
import { getTopic } from "../../hooks/room/useTopic" ;
80
77
import { SdkContextClass } from "../../contexts/SDKContext" ;
81
78
import { getDisplayAliasForAliasSet } from "../../Rooms" ;
@@ -148,7 +145,7 @@ const Tile: React.FC<ITileProps> = ({
148
145
let button : ReactElement ;
149
146
if ( busy ) {
150
147
button = (
151
- < AccessibleTooltipButton
148
+ < AccessibleButton
152
149
disabled = { true }
153
150
onClick = { onJoinClick }
154
151
kind = "primary_outline"
@@ -157,7 +154,7 @@ const Tile: React.FC<ITileProps> = ({
157
154
title = { _t ( "space|joining_space" ) }
158
155
>
159
156
< Spinner w = { 24 } h = { 24 } />
160
- </ AccessibleTooltipButton >
157
+ </ AccessibleButton >
161
158
) ;
162
159
} else if ( joinedRoom || room . join_rule === JoinRule . Knock ) {
163
160
// If the room is knockable, show the "View" button even if we are not a member; that
@@ -670,25 +667,16 @@ const ManageButtons: React.FC<IManageButtonsProps> = ({ hierarchy, selected, set
670
667
671
668
const disabled = ! selectedRelations . length || removing || saving ;
672
669
673
- let Button : React . ComponentType < React . ComponentProps < typeof AccessibleButton > > = AccessibleButton ;
674
- let props : Partial < ComponentProps < typeof AccessibleTooltipButton > > = { } ;
675
- if ( ! selectedRelations . length ) {
676
- Button = AccessibleTooltipButton ;
677
- props = {
678
- tooltip : _t ( "space|select_room_below" ) ,
679
- alignment : Alignment . Top ,
680
- } ;
681
- }
682
-
683
670
let buttonText = _t ( "common|saving" ) ;
684
671
if ( ! saving ) {
685
672
buttonText = selectionAllSuggested ? _t ( "space|unmark_suggested" ) : _t ( "space|mark_suggested" ) ;
686
673
}
687
674
675
+ const title = ! selectedRelations . length ? _t ( "space|select_room_below" ) : undefined ;
676
+
688
677
return (
689
678
< >
690
- < Button
691
- { ...props }
679
+ < AccessibleButton
692
680
onClick = { async ( ) : Promise < void > => {
693
681
setRemoving ( true ) ;
694
682
try {
@@ -719,11 +707,13 @@ const ManageButtons: React.FC<IManageButtonsProps> = ({ hierarchy, selected, set
719
707
} }
720
708
kind = "danger_outline"
721
709
disabled = { disabled }
710
+ aria-label = { removing ? _t ( "redact|ongoing" ) : _t ( "action|remove" ) }
711
+ title = { title }
712
+ placement = "top"
722
713
>
723
714
{ removing ? _t ( "redact|ongoing" ) : _t ( "action|remove" ) }
724
- </ Button >
725
- < Button
726
- { ...props }
715
+ </ AccessibleButton >
716
+ < AccessibleButton
727
717
onClick = { async ( ) : Promise < void > => {
728
718
setSaving ( true ) ;
729
719
try {
@@ -750,9 +740,12 @@ const ManageButtons: React.FC<IManageButtonsProps> = ({ hierarchy, selected, set
750
740
} }
751
741
kind = "primary_outline"
752
742
disabled = { disabled }
743
+ aria-label = { buttonText }
744
+ title = { title }
745
+ placement = "top"
753
746
>
754
747
{ buttonText }
755
- </ Button >
748
+ </ AccessibleButton >
756
749
</ >
757
750
) ;
758
751
} ;
0 commit comments