@@ -6,7 +6,6 @@ import { collectingAPI, requests } from "api";
66import { useDispatch } from "react-redux" ;
77import { entityStoreActions } from "actions" ;
88import withReadingGroups from "hoc/withReadingGroups" ;
9- import withScreenReaderStatus from "hoc/withScreenReaderStatus" ;
109import Dialog from "frontend/components/collecting/Dialog" ;
1110import Text from "./Text" ;
1211import Icons from "./Icons" ;
@@ -51,7 +50,6 @@ function CollectingToggle({
5150 onDialogOpen,
5251 onDialogClose,
5352 readingGroups : myReadingGroups ,
54- setScreenReaderStatus,
5553 onUncollect,
5654 hiddenIfUncollected
5755} ) {
@@ -87,21 +85,6 @@ function CollectingToggle({
8785 const collectableTitle = normalizeTitle ( collectable ) ;
8886 const useOutlinedStarIcon = outlined && view === "add" ;
8987
90- const screenReaderButtonText = ( ) => {
91- if ( hasReadingGroups )
92- return t ( "actions.toggle_collecting" , { title : collectableTitle } ) ;
93- switch ( view ) {
94- case "add" :
95- case "add-active" :
96- return t ( "actions.collect" , { title : collectableTitle } ) ;
97- case "remove" :
98- case "remove-active" :
99- return t ( "actions.uncollect" , { title : collectableTitle } ) ;
100- default :
101- return "" ;
102- }
103- } ;
104-
10588 const screenReaderButtonProps = ( ) => {
10689 if ( ! hasReadingGroups ) return { } ;
10790 return {
@@ -116,7 +99,6 @@ function CollectingToggle({
11699 dispatch ( collectRequest ) ;
117100 setHovered ( false ) ;
118101 setIsCollecting ( true ) ;
119- setScreenReaderStatus ( t ( "messages.collected" , { title : collectableTitle } ) ) ;
120102 }
121103
122104 function doRemove ( collection = currentUser ) {
@@ -127,16 +109,6 @@ function CollectingToggle({
127109 } ) ;
128110 setConfirmed ( false ) ;
129111 setHovered ( false ) ;
130- setScreenReaderStatus (
131- t ( "messages.uncollected" , { title : collectableTitle } )
132- ) ;
133- }
134-
135- function onSRClick ( event ) {
136- event . stopPropagation ( ) ;
137- // show dialog if user belongs to any RGs
138- if ( hasReadingGroups ) return setDialogVisible ( true ) ;
139- collected ? doRemove ( ) : doCollect ( ) ;
140112 }
141113
142114 function onClick ( event ) {
@@ -181,13 +153,6 @@ function CollectingToggle({
181153
182154 return (
183155 < >
184- < button
185- className = "sr-collecting-toggle screen-reader-text"
186- onClick = { onSRClick }
187- { ...screenReaderButtonProps ( ) }
188- >
189- { screenReaderButtonText ( ) }
190- </ button >
191156 < button
192157 onClick = { onClick }
193158 onMouseEnter = { onEnter }
@@ -200,15 +165,13 @@ function CollectingToggle({
200165 "collecting-toggle--filled-always" : ! outlined ,
201166 "collecting-toggle--toc-hidden" : hiddenIfUncollected && ! collected
202167 } ) }
203- aria-hidden = "true"
204- tabIndex = { - 1 }
168+ { ...screenReaderButtonProps ( ) }
205169 >
206170 < div
207171 className = { classNames ( {
208172 "collecting-toggle__inner" : true ,
209173 [ `collecting-toggle__inner--${ view } ` ] : true
210174 } ) }
211- aria-hidden = "true"
212175 >
213176 < Icons useOutline = { useOutlinedStarIcon } />
214177 < Text view = { view } />
@@ -235,11 +198,10 @@ CollectingToggle.propTypes = {
235198 readingGroups : PropTypes . array ,
236199 onDialogOpen : PropTypes . func ,
237200 onDialogClose : PropTypes . func ,
238- setScreenReaderStatus : PropTypes . func ,
239201 onUncollect : PropTypes . func ,
240202 inline : PropTypes . bool ,
241203 outlined : PropTypes . bool ,
242204 hiddenIfUncollected : PropTypes . bool
243205} ;
244206
245- export default withReadingGroups ( withScreenReaderStatus ( CollectingToggle ) ) ;
207+ export default withReadingGroups ( CollectingToggle ) ;
0 commit comments