@oxy.so/services 4.0.6 → 4.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/ui/components/FollowButton.js +26 -1
- package/lib/commonjs/ui/components/FollowButton.js.map +1 -1
- package/lib/commonjs/ui/components/FollowTargetButton.js +6 -1
- package/lib/commonjs/ui/components/FollowTargetButton.js.map +1 -1
- package/lib/commonjs/ui/components/followButtonAccessibility.js +72 -0
- package/lib/commonjs/ui/components/followButtonAccessibility.js.map +1 -0
- package/lib/module/ui/components/FollowButton.js +26 -1
- package/lib/module/ui/components/FollowButton.js.map +1 -1
- package/lib/module/ui/components/FollowTargetButton.js +6 -1
- package/lib/module/ui/components/FollowTargetButton.js.map +1 -1
- package/lib/module/ui/components/followButtonAccessibility.js +66 -0
- package/lib/module/ui/components/followButtonAccessibility.js.map +1 -0
- package/lib/typescript/commonjs/ui/components/FollowButton.d.ts +6 -0
- package/lib/typescript/commonjs/ui/components/FollowButton.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/FollowTargetButton.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/followButtonAccessibility.d.ts +48 -0
- package/lib/typescript/commonjs/ui/components/followButtonAccessibility.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/FollowButton.d.ts +6 -0
- package/lib/typescript/module/ui/components/FollowButton.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/FollowTargetButton.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/followButtonAccessibility.d.ts +48 -0
- package/lib/typescript/module/ui/components/followButtonAccessibility.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/ui/components/FollowButton.tsx +25 -0
- package/src/ui/components/FollowTargetButton.tsx +4 -0
- package/src/ui/components/__tests__/followButtonAccessibility.test.tsx +191 -0
- package/src/ui/components/followButtonAccessibility.ts +83 -0
|
@@ -11,6 +11,7 @@ var _mediaHeader = require("@oxy.so/bloom/media-header");
|
|
|
11
11
|
var _useFollow = require("../hooks/useFollow.js");
|
|
12
12
|
var _followStore = require("../stores/followStore.js");
|
|
13
13
|
var _shallow = require("zustand/react/shallow");
|
|
14
|
+
var _followButtonAccessibility = require("./followButtonAccessibility.js");
|
|
14
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
16
|
const DEFAULT_FOLLOW_ALL_LABEL = 'Follow all';
|
|
16
17
|
const DEFAULT_FOLLOWED_ALL_LABEL = 'Following';
|
|
@@ -31,6 +32,7 @@ const FollowButtonInner = /*#__PURE__*/(0, _react.memo)(function FollowButtonInn
|
|
|
31
32
|
userId,
|
|
32
33
|
oxyServices,
|
|
33
34
|
initiallyFollowing,
|
|
35
|
+
username,
|
|
34
36
|
size = 'medium',
|
|
35
37
|
onFollowChange,
|
|
36
38
|
style,
|
|
@@ -75,6 +77,15 @@ const FollowButtonInner = /*#__PURE__*/(0, _react.memo)(function FollowButtonInn
|
|
|
75
77
|
const isBusy = isLoading || !isKnown;
|
|
76
78
|
const showFollowing = isKnown && isFollowing;
|
|
77
79
|
const showSpinner = showLoadingState && isBusy;
|
|
80
|
+
const {
|
|
81
|
+
accessibilityLabel,
|
|
82
|
+
accessibilityHint
|
|
83
|
+
} = (0, _followButtonAccessibility.describeFollowButton)({
|
|
84
|
+
isKnown,
|
|
85
|
+
isFollowing: showFollowing,
|
|
86
|
+
isPending: isLoading,
|
|
87
|
+
username
|
|
88
|
+
});
|
|
78
89
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_mediaHeader.FollowButton, {
|
|
79
90
|
following: showFollowing,
|
|
80
91
|
onFollowChange: () => {
|
|
@@ -85,7 +96,9 @@ const FollowButtonInner = /*#__PURE__*/(0, _react.memo)(function FollowButtonInn
|
|
|
85
96
|
disabled: disabled || isBusy,
|
|
86
97
|
style: style,
|
|
87
98
|
textStyle: textStyle,
|
|
88
|
-
label: isKnown || showSpinner ? 'Follow' : ''
|
|
99
|
+
label: isKnown || showSpinner ? 'Follow' : '',
|
|
100
|
+
accessibilityLabel: accessibilityLabel,
|
|
101
|
+
accessibilityHint: accessibilityHint
|
|
89
102
|
});
|
|
90
103
|
});
|
|
91
104
|
const FollowButtonMultiInner = /*#__PURE__*/(0, _react.memo)(function FollowButtonMultiInner({
|
|
@@ -179,8 +192,20 @@ const FollowButtonMultiInner = /*#__PURE__*/(0, _react.memo)(function FollowButt
|
|
|
179
192
|
}
|
|
180
193
|
}, [disabled, isLoading, allFollowing, followAllUsers, unfollowAllUsers, onFollowChange, onBulkFollow, onBulkUnfollow, preventParentActions]);
|
|
181
194
|
const showSpinner = showLoadingState && isLoading;
|
|
195
|
+
const {
|
|
196
|
+
accessibilityLabel,
|
|
197
|
+
accessibilityHint
|
|
198
|
+
} = (0, _followButtonAccessibility.describeFollowAllButton)({
|
|
199
|
+
allFollowing,
|
|
200
|
+
isPending: Boolean(isLoading),
|
|
201
|
+
count: userIds.length,
|
|
202
|
+
followAllLabel,
|
|
203
|
+
followedAllLabel
|
|
204
|
+
});
|
|
182
205
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_mediaHeader.FollowButton, {
|
|
183
206
|
following: allFollowing,
|
|
207
|
+
accessibilityLabel: accessibilityLabel,
|
|
208
|
+
accessibilityHint: accessibilityHint,
|
|
184
209
|
onFollowChange: () => {
|
|
185
210
|
void handlePress();
|
|
186
211
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_OxyContext","_toast","_mediaHeader","_useFollow","_followStore","_shallow","_jsxRuntime","DEFAULT_FOLLOW_ALL_LABEL","DEFAULT_FOLLOWED_ALL_LABEL","isMultiMode","props","Array","isArray","userIds","FollowButtonInner","memo","userId","oxyServices","initiallyFollowing","size","onFollowChange","style","textStyle","disabled","showLoadingState","preventParentActions","isFollowing","isKnown","isLoading","toggleFollow","resolveStatus","useFollowForButton","handlePress","useCallback","event","preventDefault","stopPropagation","accepted","err","error","Error","String","toast","message","useEffect","isBusy","showFollowing","showSpinner","jsx","FollowButton","following","loading","label","FollowButtonMultiInner","initiallyAllFollowing","followAllLabel","followedAllLabel","onBulkFollow","onBulkUnfollow","follow","useFollow","followAllUsers","undefined","unfollowAllUsers","isAnyLoading","initialFollowStatuses","useFollowStore","useShallow","state","statuses","uid","Object","prototype","hasOwnProperty","call","followingUsers","hasKnownNotFollowing","some","storeAllFollowing","allFollowing","fetchAllStatuses","isSubmitting","setIsSubmitting","useState","result","allAlreadyFollowing","followedCount","results","length","every","entry","alreadyFollowing","anyFollowed","success","followingLabel","canUsePrivateApi","user","currentUser","useOxy","currentUserId","id","trim","rawUserIds","multiUserIds","useMemo","seen","Set","cleaned","raw","has","add","push","targetUserId","exports","_default","default"],"sourceRoot":"../../../../src","sources":["ui/components/FollowButton.tsx"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAMA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AAEA,IAAAM,QAAA,GAAAN,OAAA;
|
|
1
|
+
{"version":3,"names":["_react","require","_OxyContext","_toast","_mediaHeader","_useFollow","_followStore","_shallow","_followButtonAccessibility","_jsxRuntime","DEFAULT_FOLLOW_ALL_LABEL","DEFAULT_FOLLOWED_ALL_LABEL","isMultiMode","props","Array","isArray","userIds","FollowButtonInner","memo","userId","oxyServices","initiallyFollowing","username","size","onFollowChange","style","textStyle","disabled","showLoadingState","preventParentActions","isFollowing","isKnown","isLoading","toggleFollow","resolveStatus","useFollowForButton","handlePress","useCallback","event","preventDefault","stopPropagation","accepted","err","error","Error","String","toast","message","useEffect","isBusy","showFollowing","showSpinner","accessibilityLabel","accessibilityHint","describeFollowButton","isPending","jsx","FollowButton","following","loading","label","FollowButtonMultiInner","initiallyAllFollowing","followAllLabel","followedAllLabel","onBulkFollow","onBulkUnfollow","follow","useFollow","followAllUsers","undefined","unfollowAllUsers","isAnyLoading","initialFollowStatuses","useFollowStore","useShallow","state","statuses","uid","Object","prototype","hasOwnProperty","call","followingUsers","hasKnownNotFollowing","some","storeAllFollowing","allFollowing","fetchAllStatuses","isSubmitting","setIsSubmitting","useState","result","allAlreadyFollowing","followedCount","results","length","every","entry","alreadyFollowing","anyFollowed","success","describeFollowAllButton","Boolean","count","followingLabel","canUsePrivateApi","user","currentUser","useOxy","currentUserId","id","trim","rawUserIds","multiUserIds","useMemo","seen","Set","cleaned","raw","has","add","push","targetUserId","exports","_default","default"],"sourceRoot":"../../../../src","sources":["ui/components/FollowButton.tsx"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAMA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AAEA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,0BAAA,GAAAP,OAAA;AAA4F,IAAAQ,WAAA,GAAAR,OAAA;AAE5F,MAAMS,wBAAwB,GAAG,YAAY;AAC7C,MAAMC,0BAA0B,GAAG,WAAW;;AAE9C;;AAYA;;AAaA;;AAWA;AACA;AACA;AACA;;AAGA,MAAMC,WAAW,GAAIC,KAAwB,IAC3C,SAAS,IAAIA,KAAK,IAAIC,KAAK,CAACC,OAAO,CAACF,KAAK,CAACG,OAAO,CAAC;AAEpD,MAAMC,iBAAiB,gBAAG,IAAAC,WAAI,EAAC,SAASD,iBAAiBA,CAAC;EACxDE,MAAM;EACNC,WAAW;EACXC,kBAAkB;EAClBC,QAAQ;EACRC,IAAI,GAAG,QAAQ;EACfC,cAAc;EACdC,KAAK;EACLC,SAAS;EACTC,QAAQ,GAAG,KAAK;EAChBC,gBAAgB,GAAG,IAAI;EACvBC,oBAAoB,GAAG;AAC+B,CAAC,EAAE;EAEzD,MAAM;IACJC,WAAW;IACXC,OAAO;IACPC,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AC;EAEN;EAEA,MAAMS,YAAY,GAAG9G,KAAK,CAACM,MAAM,GAAG0B,MAAM,CAAChC,KAAK,CAACM,MAAM,CAAC,CAAC6F,IAAI,CAAC,CAAC,GAAG,EAAE;EACpE,IAAI,CAACW,YAAY,IAAKb,aAAa,IAAIA,aAAa,KAAKa,YAAa,EAAE;IACtE,OAAO,IAAI;EACb;EAEA,oBACE,IAAAlH,WAAA,CAAA+C,GAAA,EAACvC,iBAAiB;IAAA,GACZJ,KAAK;IACTM,MAAM,EAAEwG,YAAa;IACrBvG,WAAW,EAAEA;EAAY,CAC1B,CAAC;AAEN,CAAC;AAACwG,OAAA,CAAAnE,YAAA,GAAAA,YAAA;AAAA,IAAAoE,QAAA,GAAAD,OAAA,CAAAE,OAAA,GAGarE,YAAY","ignoreList":[]}
|
|
@@ -309,7 +309,12 @@ const FollowTargetButton = exports.FollowTargetButton = /*#__PURE__*/(0, _react.
|
|
|
309
309
|
const primary = /*#__PURE__*/(0, _jsxRuntime.jsx)(_mediaHeader.FollowButton, {
|
|
310
310
|
following: isFollowing,
|
|
311
311
|
label: isFollowing ? text.idle : label,
|
|
312
|
-
followingLabel: label
|
|
312
|
+
followingLabel: label
|
|
313
|
+
// The visible text says Following / Requested / Off here, but Bloom
|
|
314
|
+
// names the button by its idle label in every state. Name it by the
|
|
315
|
+
// state it shows (OxyHQ/oxy#1375 item 22).
|
|
316
|
+
,
|
|
317
|
+
accessibilityLabel: label,
|
|
313
318
|
size: size,
|
|
314
319
|
disabled: disabled || isUnknown,
|
|
315
320
|
loading: isPending || isUnknown,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactNative","_mediaHeader","_button","_RiArrowDownSLine","_dropdownMenu","_toast","_useFollowTarget","_followTargetStore","_jsxRuntime","VERB_LABELS","follow","idle","active","pending","disabled","subscribe","join","watch","HOUR","DEFAULT_DURATIONS","label","seconds","FOLLOW_ACTION_LEAVES_ACTIVE","exports","unfollow","resolveFollowPrimaryAction","input","isFollowing","applicationMode","buildFollowMenuItems","items","following","durations","d","push","key","idleVerb","toLowerCase","action","type","durationLabel","hasRelationship","isPending","applicationName","FollowTargetButton","memo","targetId","verb","labels","size","style","showOptions","initialStatus","onChange","status","isUnknown","disableHere","enableHere","useFollowTarget","reportMutationFailure","useCallback","message","useFollowTargetStore","getState","errors","toast","error","text","useMemo","globalState","handlePrimary","handleTimed","expiresIn","success","menuItems","Boolean","relationshipId","runItem","item","then","ok","primary","jsx","FollowButton","followingLabel","loading","onFollowChange","length","View","children","jsxs","flexDirection","alignItems","gap","DropdownMenu","DropdownMenuTrigger","asChild","Button","appearance","tone","icon","RiArrowDownSLine","width","
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","_mediaHeader","_button","_RiArrowDownSLine","_dropdownMenu","_toast","_useFollowTarget","_followTargetStore","_jsxRuntime","VERB_LABELS","follow","idle","active","pending","disabled","subscribe","join","watch","HOUR","DEFAULT_DURATIONS","label","seconds","FOLLOW_ACTION_LEAVES_ACTIVE","exports","unfollow","resolveFollowPrimaryAction","input","isFollowing","applicationMode","buildFollowMenuItems","items","following","durations","d","push","key","idleVerb","toLowerCase","action","type","durationLabel","hasRelationship","isPending","applicationName","FollowTargetButton","memo","targetId","verb","labels","size","style","showOptions","initialStatus","onChange","status","isUnknown","disableHere","enableHere","useFollowTarget","reportMutationFailure","useCallback","message","useFollowTargetStore","getState","errors","toast","error","text","useMemo","globalState","handlePrimary","handleTimed","expiresIn","success","menuItems","Boolean","relationshipId","runItem","item","then","ok","primary","jsx","FollowButton","followingLabel","accessibilityLabel","loading","onFollowChange","length","View","children","jsxs","flexDirection","alignItems","gap","DropdownMenu","DropdownMenuTrigger","asChild","Button","appearance","tone","icon","RiArrowDownSLine","width","accessibilityHint","DropdownMenuContent","map","DropdownMenuItem","onPress"],"sourceRoot":"../../../../src","sources":["ui/components/FollowTargetButton.tsx"],"mappings":";;;;;;;;AAiCA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAA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,IAAIyC,SAAU;UAChC8B,kBAAkB,EAAE,GAAGjE,KAAK,UAAW;UACvCoF,iBAAiB,EAAC;QAAsB,CACzC;MAAC,CACiB,CAAC,eACtB,IAAAhG,WAAA,CAAA0E,GAAA,EAAC9E,aAAA,CAAAqG,mBAAmB;QAACrF,KAAK,EAAE,GAAGA,KAAK,UAAW;QAAAsE,QAAA,EAC5ChB,SAAS,CAACgC,GAAG,CAAE5B,IAAI,iBAClB,IAAAtE,WAAA,CAAA0E,GAAA,EAAC9E,aAAA,CAAAuG,gBAAgB;UAAgBC,OAAO,EAAEA,CAAA,KAAM/B,OAAO,CAACC,IAAI,CAAE;UAAAY,QAAA,EAC3DZ,IAAI,CAAC1D;QAAK,GADU0D,IAAI,CAAC3C,GAEV,CACnB;MAAC,CACiB,CAAC;IAAA,CACV,CAAC;EAAA,CACX,CAAC;AAEX,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.describeFollowAllButton = describeFollowAllButton;
|
|
7
|
+
exports.describeFollowButton = describeFollowButton;
|
|
8
|
+
exports.formatHandle = formatHandle;
|
|
9
|
+
/**
|
|
10
|
+
* What a screen reader hears for a follow button.
|
|
11
|
+
*
|
|
12
|
+
* Bloom's `FollowButton` names itself "Follow" in both states and carries the
|
|
13
|
+
* state in its pressed flag. Android TalkBack reads that flag as "selected",
|
|
14
|
+
* so a button that SHOWS "Following" was announced as "Follow, selected", and a
|
|
15
|
+
* TalkBack user could not tell they already follow the account
|
|
16
|
+
* (OxyHQ/oxy#1375 item 22). The name now says the state, and who it is for
|
|
17
|
+
* when the caller knows the handle.
|
|
18
|
+
*
|
|
19
|
+
* Pure, and kept apart from the components, so every state is pinned by a
|
|
20
|
+
* table test rather than by a render that can only see one state at a time.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/** `@nate` from `nate` or `@nate`; `undefined` when there is no handle. */
|
|
24
|
+
function formatHandle(username) {
|
|
25
|
+
const bare = username?.trim().replace(/^@+/, '');
|
|
26
|
+
return bare ? `@${bare}` : undefined;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The single-user button.
|
|
31
|
+
*
|
|
32
|
+
* - `isKnown: false`: the status is still being fetched and the button is
|
|
33
|
+
* inert, so it says so rather than offering a "Follow" it would ignore.
|
|
34
|
+
* - `isPending`: a follow or unfollow is in flight. The name keeps the state
|
|
35
|
+
* the button still shows; the busy flag says the rest, and there is no hint
|
|
36
|
+
* because a press does nothing until the write settles.
|
|
37
|
+
* - Following: "Following @nate", hinted "Unfollows @nate", because pressing
|
|
38
|
+
* it unfollows, which the visible "Following" does not say.
|
|
39
|
+
*/
|
|
40
|
+
function describeFollowButton(input) {
|
|
41
|
+
const handle = formatHandle(input.username);
|
|
42
|
+
if (!input.isKnown) {
|
|
43
|
+
return {
|
|
44
|
+
accessibilityLabel: handle ? `Checking whether you follow ${handle}` : 'Checking follow status'
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
const accessibilityLabel = input.isFollowing ? handle ? `Following ${handle}` : 'Following' : handle ? `Follow ${handle}` : 'Follow';
|
|
48
|
+
if (input.isPending || !input.isFollowing) return {
|
|
49
|
+
accessibilityLabel
|
|
50
|
+
};
|
|
51
|
+
return {
|
|
52
|
+
accessibilityLabel,
|
|
53
|
+
accessibilityHint: handle ? `Unfollows ${handle}` : 'Unfollows this account'
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The "Follow all" button. The labels are the caller's, since a starter pack
|
|
59
|
+
* and a feed's member list word it differently; the hint carries the count.
|
|
60
|
+
*/
|
|
61
|
+
function describeFollowAllButton(input) {
|
|
62
|
+
const accessibilityLabel = input.allFollowing ? input.followedAllLabel : input.followAllLabel;
|
|
63
|
+
if (input.isPending) return {
|
|
64
|
+
accessibilityLabel
|
|
65
|
+
};
|
|
66
|
+
const accounts = input.count === 1 ? '1 account' : `${input.count} accounts`;
|
|
67
|
+
return {
|
|
68
|
+
accessibilityLabel,
|
|
69
|
+
accessibilityHint: input.allFollowing ? `Unfollows all ${accounts}` : `Follows all ${accounts}`
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=followButtonAccessibility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["formatHandle","username","bare","trim","replace","undefined","describeFollowButton","input","handle","isKnown","accessibilityLabel","isFollowing","isPending","accessibilityHint","describeFollowAllButton","allFollowing","followedAllLabel","followAllLabel","accounts","count"],"sourceRoot":"../../../../src","sources":["ui/components/followButtonAccessibility.ts"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA;AACO,SAASA,YAAYA,CAACC,QAA4B,EAAsB;EAC7E,MAAMC,IAAI,GAAGD,QAAQ,EAAEE,IAAI,CAAC,CAAC,CAACC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;EAChD,OAAOF,IAAI,GAAG,IAAIA,IAAI,EAAE,GAAGG,SAAS;AACtC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,oBAAoBA,CAACC,KAKpC,EAA6B;EAC5B,MAAMC,MAAM,GAAGR,YAAY,CAACO,KAAK,CAACN,QAAQ,CAAC;EAE3C,IAAI,CAACM,KAAK,CAACE,OAAO,EAAE;IAClB,OAAO;MACLC,kBAAkB,EAAEF,MAAM,GACtB,+BAA+BA,MAAM,EAAE,GACvC;IACN,CAAC;EACH;EAEA,MAAME,kBAAkB,GAAGH,KAAK,CAACI,WAAW,GACxCH,MAAM,GAAG,aAAaA,MAAM,EAAE,GAAG,WAAW,GAC5CA,MAAM,GAAG,UAAUA,MAAM,EAAE,GAAG,QAAQ;EAE1C,IAAID,KAAK,CAACK,SAAS,IAAI,CAACL,KAAK,CAACI,WAAW,EAAE,OAAO;IAAED;EAAmB,CAAC;EAExE,OAAO;IACLA,kBAAkB;IAClBG,iBAAiB,EAAEL,MAAM,GAAG,aAAaA,MAAM,EAAE,GAAG;EACtD,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACO,SAASM,uBAAuBA,CAACP,KAMvC,EAA6B;EAC5B,MAAMG,kBAAkB,GAAGH,KAAK,CAACQ,YAAY,GAAGR,KAAK,CAACS,gBAAgB,GAAGT,KAAK,CAACU,cAAc;EAC7F,IAAIV,KAAK,CAACK,SAAS,EAAE,OAAO;IAAEF;EAAmB,CAAC;EAClD,MAAMQ,QAAQ,GAAGX,KAAK,CAACY,KAAK,KAAK,CAAC,GAAG,WAAW,GAAG,GAAGZ,KAAK,CAACY,KAAK,WAAW;EAC5E,OAAO;IACLT,kBAAkB;IAClBG,iBAAiB,EAAEN,KAAK,CAACQ,YAAY,GAAG,iBAAiBG,QAAQ,EAAE,GAAG,eAAeA,QAAQ;EAC/F,CAAC;AACH","ignoreList":[]}
|
|
@@ -7,6 +7,7 @@ import { FollowButton as BloomFollowButton } from '@oxy.so/bloom/media-header';
|
|
|
7
7
|
import { useFollow, useFollowForButton } from "../hooks/useFollow.js";
|
|
8
8
|
import { useFollowStore } from "../stores/followStore.js";
|
|
9
9
|
import { useShallow } from 'zustand/react/shallow';
|
|
10
|
+
import { describeFollowAllButton, describeFollowButton } from "./followButtonAccessibility.js";
|
|
10
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
12
|
const DEFAULT_FOLLOW_ALL_LABEL = 'Follow all';
|
|
12
13
|
const DEFAULT_FOLLOWED_ALL_LABEL = 'Following';
|
|
@@ -27,6 +28,7 @@ const FollowButtonInner = /*#__PURE__*/memo(function FollowButtonInner({
|
|
|
27
28
|
userId,
|
|
28
29
|
oxyServices,
|
|
29
30
|
initiallyFollowing,
|
|
31
|
+
username,
|
|
30
32
|
size = 'medium',
|
|
31
33
|
onFollowChange,
|
|
32
34
|
style,
|
|
@@ -71,6 +73,15 @@ const FollowButtonInner = /*#__PURE__*/memo(function FollowButtonInner({
|
|
|
71
73
|
const isBusy = isLoading || !isKnown;
|
|
72
74
|
const showFollowing = isKnown && isFollowing;
|
|
73
75
|
const showSpinner = showLoadingState && isBusy;
|
|
76
|
+
const {
|
|
77
|
+
accessibilityLabel,
|
|
78
|
+
accessibilityHint
|
|
79
|
+
} = describeFollowButton({
|
|
80
|
+
isKnown,
|
|
81
|
+
isFollowing: showFollowing,
|
|
82
|
+
isPending: isLoading,
|
|
83
|
+
username
|
|
84
|
+
});
|
|
74
85
|
return /*#__PURE__*/_jsx(BloomFollowButton, {
|
|
75
86
|
following: showFollowing,
|
|
76
87
|
onFollowChange: () => {
|
|
@@ -81,7 +92,9 @@ const FollowButtonInner = /*#__PURE__*/memo(function FollowButtonInner({
|
|
|
81
92
|
disabled: disabled || isBusy,
|
|
82
93
|
style: style,
|
|
83
94
|
textStyle: textStyle,
|
|
84
|
-
label: isKnown || showSpinner ? 'Follow' : ''
|
|
95
|
+
label: isKnown || showSpinner ? 'Follow' : '',
|
|
96
|
+
accessibilityLabel: accessibilityLabel,
|
|
97
|
+
accessibilityHint: accessibilityHint
|
|
85
98
|
});
|
|
86
99
|
});
|
|
87
100
|
const FollowButtonMultiInner = /*#__PURE__*/memo(function FollowButtonMultiInner({
|
|
@@ -175,8 +188,20 @@ const FollowButtonMultiInner = /*#__PURE__*/memo(function FollowButtonMultiInner
|
|
|
175
188
|
}
|
|
176
189
|
}, [disabled, isLoading, allFollowing, followAllUsers, unfollowAllUsers, onFollowChange, onBulkFollow, onBulkUnfollow, preventParentActions]);
|
|
177
190
|
const showSpinner = showLoadingState && isLoading;
|
|
191
|
+
const {
|
|
192
|
+
accessibilityLabel,
|
|
193
|
+
accessibilityHint
|
|
194
|
+
} = describeFollowAllButton({
|
|
195
|
+
allFollowing,
|
|
196
|
+
isPending: Boolean(isLoading),
|
|
197
|
+
count: userIds.length,
|
|
198
|
+
followAllLabel,
|
|
199
|
+
followedAllLabel
|
|
200
|
+
});
|
|
178
201
|
return /*#__PURE__*/_jsx(BloomFollowButton, {
|
|
179
202
|
following: allFollowing,
|
|
203
|
+
accessibilityLabel: accessibilityLabel,
|
|
204
|
+
accessibilityHint: accessibilityHint,
|
|
180
205
|
onFollowChange: () => {
|
|
181
206
|
void handlePress();
|
|
182
207
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useCallback","useMemo","useState","memo","useOxy","toast","FollowButton","BloomFollowButton","useFollow","useFollowForButton","useFollowStore","useShallow","jsx","_jsx","DEFAULT_FOLLOW_ALL_LABEL","DEFAULT_FOLLOWED_ALL_LABEL","isMultiMode","props","Array","isArray","userIds","FollowButtonInner","userId","oxyServices","initiallyFollowing","size","onFollowChange","style","textStyle","disabled","showLoadingState","preventParentActions","isFollowing","isKnown","isLoading","toggleFollow","resolveStatus","handlePress","event","preventDefault","stopPropagation","accepted","err","error","Error","String","message","isBusy","showFollowing","showSpinner","following","loading","label","FollowButtonMultiInner","initiallyAllFollowing","followAllLabel","followedAllLabel","onBulkFollow","onBulkUnfollow","follow","followAllUsers","undefined","unfollowAllUsers","isAnyLoading","initialFollowStatuses","state","statuses","uid","Object","prototype","hasOwnProperty","call","followingUsers","hasKnownNotFollowing","some","storeAllFollowing","allFollowing","fetchAllStatuses","isSubmitting","setIsSubmitting","result","allAlreadyFollowing","followedCount","results","length","every","entry","alreadyFollowing","anyFollowed","success","followingLabel","canUsePrivateApi","user","currentUser","currentUserId","id","trim","rawUserIds","multiUserIds","seen","Set","cleaned","raw","has","add","push","targetUserId"],"sourceRoot":"../../../../src","sources":["ui/components/FollowButton.tsx"],"mappings":";;AACA,SAASA,SAAS,EAAEC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,IAAI,QAAQ,OAAO;AAMvE,SAASC,MAAM,QAAQ,0BAAuB;AAC9C,SAASC,KAAK,QAAQ,qBAAqB;AAC3C,SAASC,YAAY,IAAIC,iBAAiB,QAAQ,4BAA4B;AAC9E,SAASC,SAAS,EAAEC,kBAAkB,QAAQ,uBAAoB;AAClE,SAASC,cAAc,QAAQ,0BAAuB;AAEtD,SAASC,UAAU,QAAQ,uBAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA;
|
|
1
|
+
{"version":3,"names":["useEffect","useCallback","useMemo","useState","memo","useOxy","toast","FollowButton","BloomFollowButton","useFollow","useFollowForButton","useFollowStore","useShallow","describeFollowAllButton","describeFollowButton","jsx","_jsx","DEFAULT_FOLLOW_ALL_LABEL","DEFAULT_FOLLOWED_ALL_LABEL","isMultiMode","props","Array","isArray","userIds","FollowButtonInner","userId","oxyServices","initiallyFollowing","username","size","onFollowChange","style","textStyle","disabled","showLoadingState","preventParentActions","isFollowing","isKnown","isLoading","toggleFollow","resolveStatus","handlePress","event","preventDefault","stopPropagation","accepted","err","error","Error","String","message","isBusy","showFollowing","showSpinner","accessibilityLabel","accessibilityHint","isPending","following","loading","label","FollowButtonMultiInner","initiallyAllFollowing","followAllLabel","followedAllLabel","onBulkFollow","onBulkUnfollow","follow","followAllUsers","undefined","unfollowAllUsers","isAnyLoading","initialFollowStatuses","state","statuses","uid","Object","prototype","hasOwnProperty","call","followingUsers","hasKnownNotFollowing","some","storeAllFollowing","allFollowing","fetchAllStatuses","isSubmitting","setIsSubmitting","result","allAlreadyFollowing","followedCount","results","length","every","entry","alreadyFollowing","anyFollowed","success","Boolean","count","followingLabel","canUsePrivateApi","user","currentUser","currentUserId","id","trim","rawUserIds","multiUserIds","seen","Set","cleaned","raw","has","add","push","targetUserId"],"sourceRoot":"../../../../src","sources":["ui/components/FollowButton.tsx"],"mappings":";;AACA,SAASA,SAAS,EAAEC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,IAAI,QAAQ,OAAO;AAMvE,SAASC,MAAM,QAAQ,0BAAuB;AAC9C,SAASC,KAAK,QAAQ,qBAAqB;AAC3C,SAASC,YA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AE,GAAGO,GAAG,GAAG9D,MAAM,CAAC8D,GAAG,CAAC,CAACN,IAAI,CAAC,CAAC,GAAG,EAAE;MACxC,IAAI,CAACD,EAAE,IAAIA,EAAE,KAAKD,aAAa,IAAIK,IAAI,CAACI,GAAG,CAACR,EAAE,CAAC,EAAE;MACjDI,IAAI,CAACK,GAAG,CAACT,EAAE,CAAC;MACZM,OAAO,CAACI,IAAI,CAACV,EAAE,CAAC;IAClB;IACA,OAAOM,OAAO;EAChB,CAAC,EAAE,CAACJ,UAAU,EAAEH,aAAa,CAAC,CAAC;EAE/B,IAAI,CAACH,gBAAgB,EAAE;IACrB,OAAO,IAAI;EACb;EAEA,IAAIjF,WAAW,CAACC,KAAK,CAAC,EAAE;IACtB,IAAIuF,YAAY,CAAChB,MAAM,KAAK,CAAC,EAAE;MAC7B,OAAO,IAAI;IACb;IACA,oBACE3E,IAAA,CAAC4C,sBAAsB;MAAA,GACjBxC,KAAK;MACTG,OAAO,EAAEoF;IAAa,CACvB,CAAC;EAEN;EAEA,MAAMQ,YAAY,GAAG/F,KAAK,CAACK,MAAM,GAAGwB,MAAM,CAAC7B,KAAK,CAACK,MAAM,CAAC,CAACgF,IAAI,CAAC,CAAC,GAAG,EAAE;EACpE,IAAI,CAACU,YAAY,IAAKZ,aAAa,IAAIA,aAAa,KAAKY,YAAa,EAAE;IACtE,OAAO,IAAI;EACb;EAEA,oBACEnG,IAAA,CAACQ,iBAAiB;IAAA,GACZJ,KAAK;IACTK,MAAM,EAAE0F,YAAa;IACrBzF,WAAW,EAAEA;EAAY,CAC1B,CAAC;AAEN,CAAC;AAED,SAASnB,YAAY;AACrB,eAAeA,YAAY","ignoreList":[]}
|
|
@@ -302,7 +302,12 @@ export const FollowTargetButton = /*#__PURE__*/memo(function FollowTargetButton(
|
|
|
302
302
|
const primary = /*#__PURE__*/_jsx(BloomFollowButton, {
|
|
303
303
|
following: isFollowing,
|
|
304
304
|
label: isFollowing ? text.idle : label,
|
|
305
|
-
followingLabel: label
|
|
305
|
+
followingLabel: label
|
|
306
|
+
// The visible text says Following / Requested / Off here, but Bloom
|
|
307
|
+
// names the button by its idle label in every state. Name it by the
|
|
308
|
+
// state it shows (OxyHQ/oxy#1375 item 22).
|
|
309
|
+
,
|
|
310
|
+
accessibilityLabel: label,
|
|
306
311
|
size: size,
|
|
307
312
|
disabled: disabled || isUnknown,
|
|
308
313
|
loading: isPending || isUnknown,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["memo","useCallback","useMemo","View","FollowButton","BloomFollowButton","Button","RiArrowDownSLine","ChevronDown","DropdownMenu","DropdownMenuContent","DropdownMenuItem","DropdownMenuTrigger","toast","useFollowTarget","useFollowTargetStore","jsx","_jsx","jsxs","_jsxs","VERB_LABELS","follow","idle","active","pending","disabled","subscribe","join","watch","HOUR","DEFAULT_DURATIONS","label","seconds","FOLLOW_ACTION_LEAVES_ACTIVE","unfollow","resolveFollowPrimaryAction","input","isFollowing","applicationMode","buildFollowMenuItems","items","following","durations","d","push","key","idleVerb","toLowerCase","action","type","durationLabel","hasRelationship","isPending","applicationName","FollowTargetButton","targetId","verb","labels","size","style","showOptions","initialStatus","onChange","status","isUnknown","disableHere","enableHere","reportMutationFailure","message","getState","errors","error","text","globalState","handlePrimary","handleTimed","expiresIn","success","menuItems","Boolean","relationshipId","runItem","item","then","ok","primary","followingLabel","loading","onFollowChange","length","children","flexDirection","alignItems","gap","asChild","appearance","tone","icon","width","
|
|
1
|
+
{"version":3,"names":["memo","useCallback","useMemo","View","FollowButton","BloomFollowButton","Button","RiArrowDownSLine","ChevronDown","DropdownMenu","DropdownMenuContent","DropdownMenuItem","DropdownMenuTrigger","toast","useFollowTarget","useFollowTargetStore","jsx","_jsx","jsxs","_jsxs","VERB_LABELS","follow","idle","active","pending","disabled","subscribe","join","watch","HOUR","DEFAULT_DURATIONS","label","seconds","FOLLOW_ACTION_LEAVES_ACTIVE","unfollow","resolveFollowPrimaryAction","input","isFollowing","applicationMode","buildFollowMenuItems","items","following","durations","d","push","key","idleVerb","toLowerCase","action","type","durationLabel","hasRelationship","isPending","applicationName","FollowTargetButton","targetId","verb","labels","size","style","showOptions","initialStatus","onChange","status","isUnknown","disableHere","enableHere","reportMutationFailure","message","getState","errors","error","text","globalState","handlePrimary","handleTimed","expiresIn","success","menuItems","Boolean","relationshipId","runItem","item","then","ok","primary","followingLabel","accessibilityLabel","loading","onFollowChange","length","children","flexDirection","alignItems","gap","asChild","appearance","tone","icon","width","accessibilityHint","map","onPress"],"sourceRoot":"../../../../src","sources":["ui/components/FollowTargetButton.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,EAAEC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAGlD,SAASC,IAAI,QAAQ,cAAc;AACnC,SAASC,YAAY,IAAIC,iBAAiB,QAAQ,4BAA4B;AAC9E,SAASC,MAAM,QAAQ,sBAAsB;AAC7C;AACA;AACA;AACA;AACA,SAASC,gBAAgB,IAAIC,WAAW,QAAQ,sCAAsC;AACtF,SACEC,YAAY,EACZC,mBAAmB,EACnBC,gBAAgB,EAChBC,mBAAmB,QACd,6BAA6B;AACpC,SAASC,KAAK,QAAQ,qBAAqB;AAC3C,SAASC,eAAe,QAAQ,6BAA0B;AAC1D,SAASC,oBAAoB,QAAQ,gCAA6B;;AAElE;AACA;AACA;AACA;AACA;AAJA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAkBA,MAAMC,WAA6C,GAAG;EACpDC,MAAM,EAAE;IAAEC,IAAI,EAAE,QAAQ;IAAEC,MAAM,EAAE,WAAW;IAAEC,OAAO,EAAE,WAAW;IAAEC,QAAQ,EAAE;EAAW,CAAC;EAC3FC,SAAS,EAAE;IACTJ,IAAI,EAA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0F,UAAU,EAAC,QAAQ;UAACC,IAAI,EAAC,SAAS;UAClCvC,IAAI,EAAEA,IAAI,KAAK,OAAO,GAAG,OAAO,GAAG,OAAQ;UAC3CwC,IAAI,eAAEjF,IAAA,CAACT,WAAW;YAAC2F,KAAK,EAAE;UAAG,CAAE,CAAE;UACjC1E,QAAQ,EAAEA,QAAQ,IAAIuC,SAAU;UAChCuB,kBAAkB,EAAE,GAAGxD,KAAK,UAAW;UACvCqE,iBAAiB,EAAC;QAAsB,CACzC;MAAC,CACiB,CAAC,eACtBnF,IAAA,CAACP,mBAAmB;QAACqB,KAAK,EAAE,GAAGA,KAAK,UAAW;QAAA4D,QAAA,EAC5Cb,SAAS,CAACuB,GAAG,CAAEnB,IAAI,iBAClBjE,IAAA,CAACN,gBAAgB;UAAgB2F,OAAO,EAAEA,CAAA,KAAMrB,OAAO,CAACC,IAAI,CAAE;UAAAS,QAAA,EAC3DT,IAAI,CAACnD;QAAK,GADUmD,IAAI,CAACrC,GAEV,CACnB;MAAC,CACiB,CAAC;IAAA,CACV,CAAC;EAAA,CACX,CAAC;AAEX,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* What a screen reader hears for a follow button.
|
|
5
|
+
*
|
|
6
|
+
* Bloom's `FollowButton` names itself "Follow" in both states and carries the
|
|
7
|
+
* state in its pressed flag. Android TalkBack reads that flag as "selected",
|
|
8
|
+
* so a button that SHOWS "Following" was announced as "Follow, selected", and a
|
|
9
|
+
* TalkBack user could not tell they already follow the account
|
|
10
|
+
* (OxyHQ/oxy#1375 item 22). The name now says the state, and who it is for
|
|
11
|
+
* when the caller knows the handle.
|
|
12
|
+
*
|
|
13
|
+
* Pure, and kept apart from the components, so every state is pinned by a
|
|
14
|
+
* table test rather than by a render that can only see one state at a time.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/** `@nate` from `nate` or `@nate`; `undefined` when there is no handle. */
|
|
18
|
+
export function formatHandle(username) {
|
|
19
|
+
const bare = username?.trim().replace(/^@+/, '');
|
|
20
|
+
return bare ? `@${bare}` : undefined;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The single-user button.
|
|
25
|
+
*
|
|
26
|
+
* - `isKnown: false`: the status is still being fetched and the button is
|
|
27
|
+
* inert, so it says so rather than offering a "Follow" it would ignore.
|
|
28
|
+
* - `isPending`: a follow or unfollow is in flight. The name keeps the state
|
|
29
|
+
* the button still shows; the busy flag says the rest, and there is no hint
|
|
30
|
+
* because a press does nothing until the write settles.
|
|
31
|
+
* - Following: "Following @nate", hinted "Unfollows @nate", because pressing
|
|
32
|
+
* it unfollows, which the visible "Following" does not say.
|
|
33
|
+
*/
|
|
34
|
+
export function describeFollowButton(input) {
|
|
35
|
+
const handle = formatHandle(input.username);
|
|
36
|
+
if (!input.isKnown) {
|
|
37
|
+
return {
|
|
38
|
+
accessibilityLabel: handle ? `Checking whether you follow ${handle}` : 'Checking follow status'
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const accessibilityLabel = input.isFollowing ? handle ? `Following ${handle}` : 'Following' : handle ? `Follow ${handle}` : 'Follow';
|
|
42
|
+
if (input.isPending || !input.isFollowing) return {
|
|
43
|
+
accessibilityLabel
|
|
44
|
+
};
|
|
45
|
+
return {
|
|
46
|
+
accessibilityLabel,
|
|
47
|
+
accessibilityHint: handle ? `Unfollows ${handle}` : 'Unfollows this account'
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The "Follow all" button. The labels are the caller's, since a starter pack
|
|
53
|
+
* and a feed's member list word it differently; the hint carries the count.
|
|
54
|
+
*/
|
|
55
|
+
export function describeFollowAllButton(input) {
|
|
56
|
+
const accessibilityLabel = input.allFollowing ? input.followedAllLabel : input.followAllLabel;
|
|
57
|
+
if (input.isPending) return {
|
|
58
|
+
accessibilityLabel
|
|
59
|
+
};
|
|
60
|
+
const accounts = input.count === 1 ? '1 account' : `${input.count} accounts`;
|
|
61
|
+
return {
|
|
62
|
+
accessibilityLabel,
|
|
63
|
+
accessibilityHint: input.allFollowing ? `Unfollows all ${accounts}` : `Follows all ${accounts}`
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=followButtonAccessibility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["formatHandle","username","bare","trim","replace","undefined","describeFollowButton","input","handle","isKnown","accessibilityLabel","isFollowing","isPending","accessibilityHint","describeFollowAllButton","allFollowing","followedAllLabel","followAllLabel","accounts","count"],"sourceRoot":"../../../../src","sources":["ui/components/followButtonAccessibility.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA;AACA,OAAO,SAASA,YAAYA,CAACC,QAA4B,EAAsB;EAC7E,MAAMC,IAAI,GAAGD,QAAQ,EAAEE,IAAI,CAAC,CAAC,CAACC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;EAChD,OAAOF,IAAI,GAAG,IAAIA,IAAI,EAAE,GAAGG,SAAS;AACtC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAACC,KAKpC,EAA6B;EAC5B,MAAMC,MAAM,GAAGR,YAAY,CAACO,KAAK,CAACN,QAAQ,CAAC;EAE3C,IAAI,CAACM,KAAK,CAACE,OAAO,EAAE;IAClB,OAAO;MACLC,kBAAkB,EAAEF,MAAM,GACtB,+BAA+BA,MAAM,EAAE,GACvC;IACN,CAAC;EACH;EAEA,MAAME,kBAAkB,GAAGH,KAAK,CAACI,WAAW,GACxCH,MAAM,GAAG,aAAaA,MAAM,EAAE,GAAG,WAAW,GAC5CA,MAAM,GAAG,UAAUA,MAAM,EAAE,GAAG,QAAQ;EAE1C,IAAID,KAAK,CAACK,SAAS,IAAI,CAACL,KAAK,CAACI,WAAW,EAAE,OAAO;IAAED;EAAmB,CAAC;EAExE,OAAO;IACLA,kBAAkB;IAClBG,iBAAiB,EAAEL,MAAM,GAAG,aAAaA,MAAM,EAAE,GAAG;EACtD,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASM,uBAAuBA,CAACP,KAMvC,EAA6B;EAC5B,MAAMG,kBAAkB,GAAGH,KAAK,CAACQ,YAAY,GAAGR,KAAK,CAACS,gBAAgB,GAAGT,KAAK,CAACU,cAAc;EAC7F,IAAIV,KAAK,CAACK,SAAS,EAAE,OAAO;IAAEF;EAAmB,CAAC;EAClD,MAAMQ,QAAQ,GAAGX,KAAK,CAACY,KAAK,KAAK,CAAC,GAAG,WAAW,GAAG,GAAGZ,KAAK,CAACY,KAAK,WAAW;EAC5E,OAAO;IACLT,kBAAkB;IAClBG,iBAAiB,EAAEN,KAAK,CAACQ,YAAY,GAAG,iBAAiBG,QAAQ,EAAE,GAAG,eAAeA,QAAQ;EAC/F,CAAC;AACH","ignoreList":[]}
|
|
@@ -16,6 +16,12 @@ interface FollowButtonBaseProps {
|
|
|
16
16
|
export interface SingleFollowButtonProps extends FollowButtonBaseProps {
|
|
17
17
|
userId: string;
|
|
18
18
|
initiallyFollowing?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* The account's handle, with or without the `@`. A screen reader then hears
|
|
21
|
+
* "Following @nate" rather than a bare "Following"; omit it and the name
|
|
22
|
+
* still follows the state.
|
|
23
|
+
*/
|
|
24
|
+
username?: string;
|
|
19
25
|
userIds?: never;
|
|
20
26
|
}
|
|
21
27
|
/** Multi-user mode — follows MANY users in one "Follow all" action (follow-only). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FollowButton.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/FollowButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EACV,SAAS,EACT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GG;IACH,SAAS,CAAC,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IACrC;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,aAAa,CAAC,EAAE,YAAY,CAAC;IAC7B;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C;AAED,eAAO,MAAM,kBAAkB,+DAkL7B,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a screen reader hears for a follow button.
|
|
3
|
+
*
|
|
4
|
+
* Bloom's `FollowButton` names itself "Follow" in both states and carries the
|
|
5
|
+
* state in its pressed flag. Android TalkBack reads that flag as "selected",
|
|
6
|
+
* so a button that SHOWS "Following" was announced as "Follow, selected", and a
|
|
7
|
+
* TalkBack user could not tell they already follow the account
|
|
8
|
+
* (OxyHQ/oxy#1375 item 22). The name now says the state, and who it is for
|
|
9
|
+
* when the caller knows the handle.
|
|
10
|
+
*
|
|
11
|
+
* Pure, and kept apart from the components, so every state is pinned by a
|
|
12
|
+
* table test rather than by a render that can only see one state at a time.
|
|
13
|
+
*/
|
|
14
|
+
export interface FollowButtonAccessibility {
|
|
15
|
+
accessibilityLabel: string;
|
|
16
|
+
accessibilityHint?: string;
|
|
17
|
+
}
|
|
18
|
+
/** `@nate` from `nate` or `@nate`; `undefined` when there is no handle. */
|
|
19
|
+
export declare function formatHandle(username: string | undefined): string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* The single-user button.
|
|
22
|
+
*
|
|
23
|
+
* - `isKnown: false`: the status is still being fetched and the button is
|
|
24
|
+
* inert, so it says so rather than offering a "Follow" it would ignore.
|
|
25
|
+
* - `isPending`: a follow or unfollow is in flight. The name keeps the state
|
|
26
|
+
* the button still shows; the busy flag says the rest, and there is no hint
|
|
27
|
+
* because a press does nothing until the write settles.
|
|
28
|
+
* - Following: "Following @nate", hinted "Unfollows @nate", because pressing
|
|
29
|
+
* it unfollows, which the visible "Following" does not say.
|
|
30
|
+
*/
|
|
31
|
+
export declare function describeFollowButton(input: {
|
|
32
|
+
isKnown: boolean;
|
|
33
|
+
isFollowing: boolean;
|
|
34
|
+
isPending: boolean;
|
|
35
|
+
username?: string;
|
|
36
|
+
}): FollowButtonAccessibility;
|
|
37
|
+
/**
|
|
38
|
+
* The "Follow all" button. The labels are the caller's, since a starter pack
|
|
39
|
+
* and a feed's member list word it differently; the hint carries the count.
|
|
40
|
+
*/
|
|
41
|
+
export declare function describeFollowAllButton(input: {
|
|
42
|
+
allFollowing: boolean;
|
|
43
|
+
isPending: boolean;
|
|
44
|
+
count: number;
|
|
45
|
+
followAllLabel: string;
|
|
46
|
+
followedAllLabel: string;
|
|
47
|
+
}): FollowButtonAccessibility;
|
|
48
|
+
//# sourceMappingURL=followButtonAccessibility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"followButtonAccessibility.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/followButtonAccessibility.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,yBAAyB;IACxC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,2EAA2E;AAC3E,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAG7E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAC1C,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,yBAAyB,CAqB5B;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAC7C,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;CAC1B,GAAG,yBAAyB,CAQ5B"}
|
|
@@ -16,6 +16,12 @@ interface FollowButtonBaseProps {
|
|
|
16
16
|
export interface SingleFollowButtonProps extends FollowButtonBaseProps {
|
|
17
17
|
userId: string;
|
|
18
18
|
initiallyFollowing?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* The account's handle, with or without the `@`. A screen reader then hears
|
|
21
|
+
* "Following @nate" rather than a bare "Following"; omit it and the name
|
|
22
|
+
* still follows the state.
|
|
23
|
+
*/
|
|
24
|
+
username?: string;
|
|
19
25
|
userIds?: never;
|
|
20
26
|
}
|
|
21
27
|
/** Multi-user mode — follows MANY users in one "Follow all" action (follow-only). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FollowButton.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/FollowButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EACV,SAAS,EACT,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AAMtB,OAAO,KAAK,EAAe,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"FollowButton.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/FollowButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EACV,SAAS,EACT,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AAMtB,OAAO,KAAK,EAAe,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAOtF,gEAAgE;AAChE,UAAU,qBAAqB;IAC7B,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,KAAK,CAAC,EAAE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G,aAAa,CAIxC;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAC1C,SAAS,EAAE,OAAO,CAAC;IACnB,eAAe,EAAE,qBAAqB,CAAC;IACvC,eAAe,EAAE,OAAO,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;CACzB,GAAG,cAAc,EAAE,CAmCnB;AAED,MAAM,WAAW,uBAAuB;IACtC,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,qEAAqE;IACrE,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/B,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IACrC;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,aAAa,CAAC,EAAE,YAAY,CAAC;IAC7B;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C;AAED,eAAO,MAAM,kBAAkB,+DAkL7B,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a screen reader hears for a follow button.
|
|
3
|
+
*
|
|
4
|
+
* Bloom's `FollowButton` names itself "Follow" in both states and carries the
|
|
5
|
+
* state in its pressed flag. Android TalkBack reads that flag as "selected",
|
|
6
|
+
* so a button that SHOWS "Following" was announced as "Follow, selected", and a
|
|
7
|
+
* TalkBack user could not tell they already follow the account
|
|
8
|
+
* (OxyHQ/oxy#1375 item 22). The name now says the state, and who it is for
|
|
9
|
+
* when the caller knows the handle.
|
|
10
|
+
*
|
|
11
|
+
* Pure, and kept apart from the components, so every state is pinned by a
|
|
12
|
+
* table test rather than by a render that can only see one state at a time.
|
|
13
|
+
*/
|
|
14
|
+
export interface FollowButtonAccessibility {
|
|
15
|
+
accessibilityLabel: string;
|
|
16
|
+
accessibilityHint?: string;
|
|
17
|
+
}
|
|
18
|
+
/** `@nate` from `nate` or `@nate`; `undefined` when there is no handle. */
|
|
19
|
+
export declare function formatHandle(username: string | undefined): string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* The single-user button.
|
|
22
|
+
*
|
|
23
|
+
* - `isKnown: false`: the status is still being fetched and the button is
|
|
24
|
+
* inert, so it says so rather than offering a "Follow" it would ignore.
|
|
25
|
+
* - `isPending`: a follow or unfollow is in flight. The name keeps the state
|
|
26
|
+
* the button still shows; the busy flag says the rest, and there is no hint
|
|
27
|
+
* because a press does nothing until the write settles.
|
|
28
|
+
* - Following: "Following @nate", hinted "Unfollows @nate", because pressing
|
|
29
|
+
* it unfollows, which the visible "Following" does not say.
|
|
30
|
+
*/
|
|
31
|
+
export declare function describeFollowButton(input: {
|
|
32
|
+
isKnown: boolean;
|
|
33
|
+
isFollowing: boolean;
|
|
34
|
+
isPending: boolean;
|
|
35
|
+
username?: string;
|
|
36
|
+
}): FollowButtonAccessibility;
|
|
37
|
+
/**
|
|
38
|
+
* The "Follow all" button. The labels are the caller's, since a starter pack
|
|
39
|
+
* and a feed's member list word it differently; the hint carries the count.
|
|
40
|
+
*/
|
|
41
|
+
export declare function describeFollowAllButton(input: {
|
|
42
|
+
allFollowing: boolean;
|
|
43
|
+
isPending: boolean;
|
|
44
|
+
count: number;
|
|
45
|
+
followAllLabel: string;
|
|
46
|
+
followedAllLabel: string;
|
|
47
|
+
}): FollowButtonAccessibility;
|
|
48
|
+
//# sourceMappingURL=followButtonAccessibility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"followButtonAccessibility.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/followButtonAccessibility.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,yBAAyB;IACxC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,2EAA2E;AAC3E,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAG7E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAC1C,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,yBAAyB,CAqB5B;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAC7C,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;CAC1B,GAAG,yBAAyB,CAQ5B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxy.so/services",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.7",
|
|
4
4
|
"description": "OxyHQ Expo/React Native SDK — UI components, screens, and native features",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -164,7 +164,7 @@
|
|
|
164
164
|
"@commitlint/cli": "^21.2.1",
|
|
165
165
|
"@commitlint/config-conventional": "^21.2.0",
|
|
166
166
|
"@expo/vector-icons": "^15.0.3",
|
|
167
|
-
"@oxy.so/core": "1.
|
|
167
|
+
"@oxy.so/core": "1.12.1",
|
|
168
168
|
"@react-native-async-storage/async-storage": "^2.0.0",
|
|
169
169
|
"@react-native-community/netinfo": "^12.0.1",
|
|
170
170
|
"@react-native/babel-preset": "^0.86.2",
|
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
"@types/jest": "^30.0.0",
|
|
180
180
|
"@types/node": "^20.19.43",
|
|
181
181
|
"@types/react": "*",
|
|
182
|
-
"@oxy.so/bloom": "^4.
|
|
182
|
+
"@oxy.so/bloom": "^4.26.0",
|
|
183
183
|
"copyfiles": "^2.4.1",
|
|
184
184
|
"expo-constants": "~57.0.5",
|
|
185
185
|
"expo-file-system": "~57.0.1",
|
|
@@ -215,7 +215,7 @@
|
|
|
215
215
|
"//@oxy.so/bloom": "RE-RAISE THIS FLOOR ON EVERY BREAKING BLOOM RELEASE, in the same commit as the root package.json catalog entry and the code that requires it. The breaking position is the MAJOR, so `^3.0.1` means `>=3.0.1 <4.0.0`: 3.x minors are admitted on semver's additive promise, and Bloom 4.0.0 is refused until someone raises this deliberately. The CAP is the part that is load-bearing. An earlier revision of this key recorded the opposite trade -- an uncapped `>=` floor, accepted so that intentionally-breaking Bloom 0.x minors would not be blocked -- and that trade is closed by evidence rather than by preference: an unbounded range is exactly what let `bun install` pair this package with Bloom 1.0.0 and emit no warning at all, and 1.0.0 broke it four ways (a deleted provider, a renamed confirm option, a renamed Chip fill, and two REMOVED SUBPATHS that fail at bundle time, before any typecheck runs). A floor is a claim about what was measured; a cap is the claim that nothing beyond it was. RAISED TO 3.0.1 from `^2.1.0`. Bloom 3.0.0 breaks exactly two things -- `PageHeader` defaults to `presentation=\"floating\"` and stops hiding the title under `transparent`, and `Field disabled` now reaches the control that reads the field context -- and THIS PACKAGE IMPORTS NEITHER: it renders no `PageHeader` and no `Field`, and 3.0 removes no subpath (unlike 2.0.0, which is why that floor cost code changes and this one does not). Its six `transparent` occurrences are CSS colour values, not the PageHeader prop. The cap had to move rather than widen to a union, because leaving `^2.1.0` in place is what made `bun install` resolve a SECOND, nested Bloom 2.12.4 under this package for any app on Bloom 3 -- two copies of a library whose 3.0 contracts (`control-surface`, `TopEdgeProvider`, `ScrollOffsetProvider`) are React contexts, so a provider from one copy cannot be read by a consumer from the other. Mention's `oxyRuntimeCompatibility` test is what caught it; nothing in a typecheck can. RAISED AGAIN TO 3.2.0 from `^3.0.1`, for the same class of reason the 2.x note records, only in the other direction: 3.2.0 ADDS the per-glyph icon subpaths (`@oxy.so/bloom/icons/RiAtLine`) that this package's screens now import instead of the `@oxy.so/bloom/icons` barrel, and a missing subpath fails at bundle time, in the consumer's Metro, long after this package has typechecked and shipped. `^3.0.1` would have admitted Bloom 3.0.1 and 3.1.0, neither of which has those subpaths, so the floor is the only thing standing between a consumer and a red build. Nothing else about 3.1.0 or 3.2.0 is required here; the cap stays at the major. RAISED TO ^4.2.0: FollowButton now delegates its visuals to Bloom media-header FollowButton with loading, textStyle and large size; the new shared UI contracts require one Bloom4 context across Services and its consumer.",
|
|
216
216
|
"peerDependencies": {
|
|
217
217
|
"@expo/vector-icons": "^15.0.3",
|
|
218
|
-
"@oxy.so/bloom": "^4.
|
|
218
|
+
"@oxy.so/bloom": "^4.26.0",
|
|
219
219
|
"@oxy.so/core": "^1.12.0",
|
|
220
220
|
"@react-native-async-storage/async-storage": "^2.0.0",
|
|
221
221
|
"@react-native-community/netinfo": ">=11.4.1",
|
|
@@ -12,6 +12,7 @@ import { useFollow, useFollowForButton } from '../hooks/useFollow';
|
|
|
12
12
|
import { useFollowStore } from '../stores/followStore';
|
|
13
13
|
import type { OxyServices, BulkFollowResult, BulkUnfollowResult } from '@oxy.so/core';
|
|
14
14
|
import { useShallow } from 'zustand/react/shallow';
|
|
15
|
+
import { describeFollowAllButton, describeFollowButton } from './followButtonAccessibility';
|
|
15
16
|
|
|
16
17
|
const DEFAULT_FOLLOW_ALL_LABEL = 'Follow all';
|
|
17
18
|
const DEFAULT_FOLLOWED_ALL_LABEL = 'Following';
|
|
@@ -32,6 +33,12 @@ interface FollowButtonBaseProps {
|
|
|
32
33
|
export interface SingleFollowButtonProps extends FollowButtonBaseProps {
|
|
33
34
|
userId: string;
|
|
34
35
|
initiallyFollowing?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* The account's handle, with or without the `@`. A screen reader then hears
|
|
38
|
+
* "Following @nate" rather than a bare "Following"; omit it and the name
|
|
39
|
+
* still follows the state.
|
|
40
|
+
*/
|
|
41
|
+
username?: string;
|
|
35
42
|
userIds?: never;
|
|
36
43
|
}
|
|
37
44
|
|
|
@@ -59,6 +66,7 @@ const FollowButtonInner = memo(function FollowButtonInner({
|
|
|
59
66
|
userId,
|
|
60
67
|
oxyServices,
|
|
61
68
|
initiallyFollowing,
|
|
69
|
+
username,
|
|
62
70
|
size = 'medium',
|
|
63
71
|
onFollowChange,
|
|
64
72
|
style,
|
|
@@ -106,6 +114,12 @@ const FollowButtonInner = memo(function FollowButtonInner({
|
|
|
106
114
|
const isBusy = isLoading || !isKnown;
|
|
107
115
|
const showFollowing = isKnown && isFollowing;
|
|
108
116
|
const showSpinner = showLoadingState && isBusy;
|
|
117
|
+
const { accessibilityLabel, accessibilityHint } = describeFollowButton({
|
|
118
|
+
isKnown,
|
|
119
|
+
isFollowing: showFollowing,
|
|
120
|
+
isPending: isLoading,
|
|
121
|
+
username,
|
|
122
|
+
});
|
|
109
123
|
|
|
110
124
|
return (
|
|
111
125
|
<BloomFollowButton
|
|
@@ -117,6 +131,8 @@ const FollowButtonInner = memo(function FollowButtonInner({
|
|
|
117
131
|
style={style}
|
|
118
132
|
textStyle={textStyle}
|
|
119
133
|
label={isKnown || showSpinner ? 'Follow' : ''}
|
|
134
|
+
accessibilityLabel={accessibilityLabel}
|
|
135
|
+
accessibilityHint={accessibilityHint}
|
|
120
136
|
/>
|
|
121
137
|
);
|
|
122
138
|
});
|
|
@@ -226,10 +242,19 @@ const FollowButtonMultiInner = memo(function FollowButtonMultiInner({
|
|
|
226
242
|
}, [disabled, isLoading, allFollowing, followAllUsers, unfollowAllUsers, onFollowChange, onBulkFollow, onBulkUnfollow, preventParentActions]);
|
|
227
243
|
|
|
228
244
|
const showSpinner = showLoadingState && isLoading;
|
|
245
|
+
const { accessibilityLabel, accessibilityHint } = describeFollowAllButton({
|
|
246
|
+
allFollowing,
|
|
247
|
+
isPending: Boolean(isLoading),
|
|
248
|
+
count: userIds.length,
|
|
249
|
+
followAllLabel,
|
|
250
|
+
followedAllLabel,
|
|
251
|
+
});
|
|
229
252
|
|
|
230
253
|
return (
|
|
231
254
|
<BloomFollowButton
|
|
232
255
|
following={allFollowing}
|
|
256
|
+
accessibilityLabel={accessibilityLabel}
|
|
257
|
+
accessibilityHint={accessibilityHint}
|
|
233
258
|
onFollowChange={() => { void handlePress(); }}
|
|
234
259
|
label={followAllLabel}
|
|
235
260
|
followingLabel={followedAllLabel}
|
|
@@ -385,6 +385,10 @@ export const FollowTargetButton = memo(function FollowTargetButton({
|
|
|
385
385
|
following={isFollowing}
|
|
386
386
|
label={isFollowing ? text.idle : label}
|
|
387
387
|
followingLabel={label}
|
|
388
|
+
// The visible text says Following / Requested / Off here, but Bloom
|
|
389
|
+
// names the button by its idle label in every state. Name it by the
|
|
390
|
+
// state it shows (OxyHQ/oxy#1375 item 22).
|
|
391
|
+
accessibilityLabel={label}
|
|
388
392
|
size={size}
|
|
389
393
|
disabled={disabled || isUnknown}
|
|
390
394
|
loading={isPending || isUnknown}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The follow button's accessible name follows its state (OxyHQ/oxy#1375 item
|
|
3
|
+
* 22). On @nate's profile the button showed "Following" while TalkBack read
|
|
4
|
+
* "Follow": Bloom names the button by its idle label and leaves the state to
|
|
5
|
+
* the pressed flag, which TalkBack reads as "selected".
|
|
6
|
+
*
|
|
7
|
+
* The table pins what each state says; the render tests pin that both
|
|
8
|
+
* FollowButton modes and FollowTargetButton hand it to Bloom.
|
|
9
|
+
*/
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { render } from '@testing-library/react';
|
|
12
|
+
import {
|
|
13
|
+
describeFollowAllButton,
|
|
14
|
+
describeFollowButton,
|
|
15
|
+
formatHandle,
|
|
16
|
+
} from '../followButtonAccessibility';
|
|
17
|
+
|
|
18
|
+
interface BloomFollowProps {
|
|
19
|
+
following: boolean;
|
|
20
|
+
label?: string;
|
|
21
|
+
followingLabel?: string;
|
|
22
|
+
loading?: boolean;
|
|
23
|
+
accessibilityLabel?: string;
|
|
24
|
+
accessibilityHint?: string;
|
|
25
|
+
}
|
|
26
|
+
const mockBloomProps: BloomFollowProps[] = [];
|
|
27
|
+
const lastBloomProps = () => mockBloomProps[mockBloomProps.length - 1];
|
|
28
|
+
|
|
29
|
+
jest.mock('@oxy.so/bloom/media-header', () => ({
|
|
30
|
+
FollowButton: (props: BloomFollowProps) => {
|
|
31
|
+
mockBloomProps.push(props);
|
|
32
|
+
return null;
|
|
33
|
+
},
|
|
34
|
+
}));
|
|
35
|
+
|
|
36
|
+
let mockFollowState = { isFollowing: false, isKnown: true, isLoading: false };
|
|
37
|
+
let mockMulti = { allFollowing: false, isAnyLoading: false };
|
|
38
|
+
jest.mock('../../hooks/useFollow', () => ({
|
|
39
|
+
useFollowForButton: () => ({
|
|
40
|
+
...mockFollowState,
|
|
41
|
+
toggleFollow: jest.fn(),
|
|
42
|
+
resolveStatus: jest.fn(),
|
|
43
|
+
}),
|
|
44
|
+
useFollow: () => ({
|
|
45
|
+
...mockMulti,
|
|
46
|
+
followAllUsers: jest.fn(),
|
|
47
|
+
unfollowAllUsers: jest.fn(),
|
|
48
|
+
fetchAllStatuses: jest.fn(),
|
|
49
|
+
}),
|
|
50
|
+
}));
|
|
51
|
+
|
|
52
|
+
jest.mock('../../context/OxyContext', () => ({
|
|
53
|
+
useOxy: () => ({ oxyServices: {}, canUsePrivateApi: true, user: { id: 'viewer' } }),
|
|
54
|
+
}));
|
|
55
|
+
|
|
56
|
+
let mockTarget = {
|
|
57
|
+
status: { globalState: 'not_following', applicationMode: 'inherit', relationshipId: null },
|
|
58
|
+
isFollowing: false,
|
|
59
|
+
isUnknown: false,
|
|
60
|
+
isPending: false,
|
|
61
|
+
};
|
|
62
|
+
jest.mock('../../hooks/useFollowTarget', () => ({
|
|
63
|
+
useFollowTarget: () => ({
|
|
64
|
+
...mockTarget,
|
|
65
|
+
follow: jest.fn(),
|
|
66
|
+
unfollow: jest.fn(),
|
|
67
|
+
disableHere: jest.fn(),
|
|
68
|
+
enableHere: jest.fn(),
|
|
69
|
+
}),
|
|
70
|
+
}));
|
|
71
|
+
|
|
72
|
+
import { FollowButton } from '../FollowButton';
|
|
73
|
+
import { FollowTargetButton } from '../FollowTargetButton';
|
|
74
|
+
|
|
75
|
+
describe('describeFollowButton', () => {
|
|
76
|
+
const known = { isKnown: true, isPending: false, username: 'nate' };
|
|
77
|
+
|
|
78
|
+
it.each([
|
|
79
|
+
[{ ...known, isFollowing: true }, 'Following @nate', 'Unfollows @nate'],
|
|
80
|
+
[{ ...known, isFollowing: false }, 'Follow @nate', undefined],
|
|
81
|
+
[{ ...known, isFollowing: true, isPending: true }, 'Following @nate', undefined],
|
|
82
|
+
[{ ...known, isFollowing: false, isPending: true }, 'Follow @nate', undefined],
|
|
83
|
+
[{ ...known, isKnown: false, isFollowing: false }, 'Checking whether you follow @nate', undefined],
|
|
84
|
+
[{ ...known, username: undefined, isFollowing: true }, 'Following', 'Unfollows this account'],
|
|
85
|
+
[{ ...known, username: undefined, isFollowing: false }, 'Follow', undefined],
|
|
86
|
+
[{ ...known, username: undefined, isKnown: false, isFollowing: false }, 'Checking follow status', undefined],
|
|
87
|
+
])('%o reads "%s"', (input, label, hint) => {
|
|
88
|
+
expect(describeFollowButton(input)).toEqual(
|
|
89
|
+
hint ? { accessibilityLabel: label, accessibilityHint: hint } : { accessibilityLabel: label },
|
|
90
|
+
);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('accepts a handle with or without the @', () => {
|
|
94
|
+
expect(formatHandle('@nate')).toBe('@nate');
|
|
95
|
+
expect(formatHandle(' nate ')).toBe('@nate');
|
|
96
|
+
expect(formatHandle('')).toBeUndefined();
|
|
97
|
+
expect(formatHandle(undefined)).toBeUndefined();
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
describe('describeFollowAllButton', () => {
|
|
102
|
+
const labels = { followAllLabel: 'Follow all', followedAllLabel: 'Following' };
|
|
103
|
+
|
|
104
|
+
it('names the state and counts the accounts in the hint', () => {
|
|
105
|
+
expect(describeFollowAllButton({ ...labels, allFollowing: false, isPending: false, count: 3 })).toEqual({
|
|
106
|
+
accessibilityLabel: 'Follow all',
|
|
107
|
+
accessibilityHint: 'Follows all 3 accounts',
|
|
108
|
+
});
|
|
109
|
+
expect(describeFollowAllButton({ ...labels, allFollowing: true, isPending: false, count: 1 })).toEqual({
|
|
110
|
+
accessibilityLabel: 'Following',
|
|
111
|
+
accessibilityHint: 'Unfollows all 1 account',
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it('drops the hint while the bulk write is in flight', () => {
|
|
116
|
+
expect(describeFollowAllButton({ ...labels, allFollowing: true, isPending: true, count: 3 })).toEqual({
|
|
117
|
+
accessibilityLabel: 'Following',
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
describe('FollowButton hands Bloom a name that follows the state', () => {
|
|
123
|
+
beforeEach(() => {
|
|
124
|
+
mockBloomProps.length = 0;
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it('reads "Following @nate" while it shows Following', () => {
|
|
128
|
+
mockFollowState = { isFollowing: true, isKnown: true, isLoading: false };
|
|
129
|
+
render(<FollowButton userId="nate-id" username="nate" />);
|
|
130
|
+
expect(lastBloomProps()).toMatchObject({
|
|
131
|
+
following: true,
|
|
132
|
+
accessibilityLabel: 'Following @nate',
|
|
133
|
+
accessibilityHint: 'Unfollows @nate',
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it('reads "Follow @nate" while it shows Follow', () => {
|
|
138
|
+
mockFollowState = { isFollowing: false, isKnown: true, isLoading: false };
|
|
139
|
+
render(<FollowButton userId="nate-id" username="nate" />);
|
|
140
|
+
expect(lastBloomProps()).toMatchObject({ following: false, accessibilityLabel: 'Follow @nate' });
|
|
141
|
+
expect(lastBloomProps()?.accessibilityHint).toBeUndefined();
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it('keeps the shown state while a write is pending', () => {
|
|
145
|
+
mockFollowState = { isFollowing: true, isKnown: true, isLoading: true };
|
|
146
|
+
render(<FollowButton userId="nate-id" username="nate" />);
|
|
147
|
+
expect(lastBloomProps()).toMatchObject({ loading: true, accessibilityLabel: 'Following @nate' });
|
|
148
|
+
expect(lastBloomProps()?.accessibilityHint).toBeUndefined();
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it('says it is checking while the status is unknown', () => {
|
|
152
|
+
mockFollowState = { isFollowing: false, isKnown: false, isLoading: false };
|
|
153
|
+
render(<FollowButton userId="nate-id" username="nate" />);
|
|
154
|
+
expect(lastBloomProps()).toMatchObject({
|
|
155
|
+
loading: true,
|
|
156
|
+
accessibilityLabel: 'Checking whether you follow @nate',
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
it('names the "Follow all" button by its state too', () => {
|
|
161
|
+
mockMulti = { allFollowing: true, isAnyLoading: false };
|
|
162
|
+
render(<FollowButton userIds={['a', 'b']} />);
|
|
163
|
+
expect(lastBloomProps()).toMatchObject({
|
|
164
|
+
following: true,
|
|
165
|
+
accessibilityLabel: 'Following',
|
|
166
|
+
accessibilityHint: 'Unfollows all 2 accounts',
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
describe('FollowTargetButton names the state it shows', () => {
|
|
172
|
+
beforeEach(() => {
|
|
173
|
+
mockBloomProps.length = 0;
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
it.each([
|
|
177
|
+
['following', { globalState: 'following', applicationMode: 'inherit' }, true, 'Following'],
|
|
178
|
+
['requested', { globalState: 'requested', applicationMode: 'inherit' }, true, 'Requested'],
|
|
179
|
+
['off here', { globalState: 'following', applicationMode: 'disabled' }, true, 'Off here'],
|
|
180
|
+
['not following', { globalState: 'not_following', applicationMode: 'inherit' }, false, 'Follow'],
|
|
181
|
+
])('%s', (_name, status, isFollowing, label) => {
|
|
182
|
+
mockTarget = {
|
|
183
|
+
status: { ...status, relationshipId: null },
|
|
184
|
+
isFollowing,
|
|
185
|
+
isUnknown: false,
|
|
186
|
+
isPending: false,
|
|
187
|
+
};
|
|
188
|
+
render(<FollowTargetButton targetId="t1" showOptions={false} />);
|
|
189
|
+
expect(lastBloomProps()?.accessibilityLabel).toBe(label);
|
|
190
|
+
});
|
|
191
|
+
});
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a screen reader hears for a follow button.
|
|
3
|
+
*
|
|
4
|
+
* Bloom's `FollowButton` names itself "Follow" in both states and carries the
|
|
5
|
+
* state in its pressed flag. Android TalkBack reads that flag as "selected",
|
|
6
|
+
* so a button that SHOWS "Following" was announced as "Follow, selected", and a
|
|
7
|
+
* TalkBack user could not tell they already follow the account
|
|
8
|
+
* (OxyHQ/oxy#1375 item 22). The name now says the state, and who it is for
|
|
9
|
+
* when the caller knows the handle.
|
|
10
|
+
*
|
|
11
|
+
* Pure, and kept apart from the components, so every state is pinned by a
|
|
12
|
+
* table test rather than by a render that can only see one state at a time.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export interface FollowButtonAccessibility {
|
|
16
|
+
accessibilityLabel: string;
|
|
17
|
+
accessibilityHint?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** `@nate` from `nate` or `@nate`; `undefined` when there is no handle. */
|
|
21
|
+
export function formatHandle(username: string | undefined): string | undefined {
|
|
22
|
+
const bare = username?.trim().replace(/^@+/, '');
|
|
23
|
+
return bare ? `@${bare}` : undefined;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The single-user button.
|
|
28
|
+
*
|
|
29
|
+
* - `isKnown: false`: the status is still being fetched and the button is
|
|
30
|
+
* inert, so it says so rather than offering a "Follow" it would ignore.
|
|
31
|
+
* - `isPending`: a follow or unfollow is in flight. The name keeps the state
|
|
32
|
+
* the button still shows; the busy flag says the rest, and there is no hint
|
|
33
|
+
* because a press does nothing until the write settles.
|
|
34
|
+
* - Following: "Following @nate", hinted "Unfollows @nate", because pressing
|
|
35
|
+
* it unfollows, which the visible "Following" does not say.
|
|
36
|
+
*/
|
|
37
|
+
export function describeFollowButton(input: {
|
|
38
|
+
isKnown: boolean;
|
|
39
|
+
isFollowing: boolean;
|
|
40
|
+
isPending: boolean;
|
|
41
|
+
username?: string;
|
|
42
|
+
}): FollowButtonAccessibility {
|
|
43
|
+
const handle = formatHandle(input.username);
|
|
44
|
+
|
|
45
|
+
if (!input.isKnown) {
|
|
46
|
+
return {
|
|
47
|
+
accessibilityLabel: handle
|
|
48
|
+
? `Checking whether you follow ${handle}`
|
|
49
|
+
: 'Checking follow status',
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const accessibilityLabel = input.isFollowing
|
|
54
|
+
? handle ? `Following ${handle}` : 'Following'
|
|
55
|
+
: handle ? `Follow ${handle}` : 'Follow';
|
|
56
|
+
|
|
57
|
+
if (input.isPending || !input.isFollowing) return { accessibilityLabel };
|
|
58
|
+
|
|
59
|
+
return {
|
|
60
|
+
accessibilityLabel,
|
|
61
|
+
accessibilityHint: handle ? `Unfollows ${handle}` : 'Unfollows this account',
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The "Follow all" button. The labels are the caller's, since a starter pack
|
|
67
|
+
* and a feed's member list word it differently; the hint carries the count.
|
|
68
|
+
*/
|
|
69
|
+
export function describeFollowAllButton(input: {
|
|
70
|
+
allFollowing: boolean;
|
|
71
|
+
isPending: boolean;
|
|
72
|
+
count: number;
|
|
73
|
+
followAllLabel: string;
|
|
74
|
+
followedAllLabel: string;
|
|
75
|
+
}): FollowButtonAccessibility {
|
|
76
|
+
const accessibilityLabel = input.allFollowing ? input.followedAllLabel : input.followAllLabel;
|
|
77
|
+
if (input.isPending) return { accessibilityLabel };
|
|
78
|
+
const accounts = input.count === 1 ? '1 account' : `${input.count} accounts`;
|
|
79
|
+
return {
|
|
80
|
+
accessibilityLabel,
|
|
81
|
+
accessibilityHint: input.allFollowing ? `Unfollows all ${accounts}` : `Follows all ${accounts}`,
|
|
82
|
+
};
|
|
83
|
+
}
|