@lotics/ui 1.13.1 → 1.13.2
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/package.json +1 -1
- package/src/picker.tsx +13 -1
package/package.json
CHANGED
package/src/picker.tsx
CHANGED
|
@@ -109,7 +109,12 @@ function StandardPicker<T extends string>(props: PickerProps<T, false>) {
|
|
|
109
109
|
placeholder={placeholder}
|
|
110
110
|
enabled={!disabled}
|
|
111
111
|
>
|
|
112
|
-
{(!value || includeEmptyOption) &&
|
|
112
|
+
{(!value || includeEmptyOption) && (
|
|
113
|
+
// Show the placeholder as the empty option (the standard
|
|
114
|
+
// `<option value="" selected>Placeholder</option>` pattern) so a
|
|
115
|
+
// native select hints what to choose.
|
|
116
|
+
<RNPicker.Item label={!value ? (placeholder ?? "") : ""} value="" />
|
|
117
|
+
)}
|
|
113
118
|
{options.map((option) =>
|
|
114
119
|
option ? (
|
|
115
120
|
<RNPicker.Item
|
|
@@ -259,6 +264,13 @@ function PickerTrigger<T extends string>({
|
|
|
259
264
|
<Pressable
|
|
260
265
|
ref={ref}
|
|
261
266
|
testID={testID}
|
|
267
|
+
// Without a role this Pressable renders as an unfocusable <div> on web —
|
|
268
|
+
// the trigger drops out of the tab order and Enter/Space can't open it.
|
|
269
|
+
// `button` makes it tab-focusable and maps keyboard activation to onPress;
|
|
270
|
+
// `expanded` announces open/closed to assistive tech. The accessible name
|
|
271
|
+
// comes from the visible selection/placeholder text below.
|
|
272
|
+
accessibilityRole="button"
|
|
273
|
+
accessibilityState={{ expanded: open, disabled }}
|
|
262
274
|
style={[
|
|
263
275
|
styles.pressable,
|
|
264
276
|
open && !enableSearch && styles.opened,
|