Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions contributingGuides/SELECTION_LIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,17 @@ There are two main components:
/>
```

## Pinning the pre-selected item

A searchable list focuses its search input on open, so on mobile the keyboard covers most of the list. When the list can have a pre-selected item, pin that item to the top so it stays visible instead of hiding in its natural position below the fold.

- Snapshot the selected value when the list opens (for example with `useInitialValue`) so a later tap does not reorder the list mid-interaction.
- Pin it to the top of the full list **before** filtering with `moveInitialSelectionToTop` (from `@libs/SelectionListOrderUtils`). It no-ops for lists below `CONST.STANDARD_LIST_ITEM_LIMIT`, so short lists keep their natural order.
- Any clear/"None" row belongs directly **below** the pinned selection.
- Pages built on `SelectionScreen` get this automatically from `useSelectionListSearch`, which pins the frozen selection and returns `pinnedValues` for callers that need to know what was pinned.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Require SelectionScreen callers to invoke the search hook

When a new caller passes raw searchable data to SelectionScreen, pinning is not automatic: src/components/SelectionScreen.tsx:175-182 forwards data directly and never invokes useSelectionListSearch. This guidance can therefore cause callers to omit the ordering step and leave the saved row buried; state that callers must run the hook and pass its filteredData (or move the hook into the wrapper) rather than claiming SelectionScreen provides it automatically.

Useful? React with 👍 / 👎.


This is enforced in review by [UI-6](../.claude/skills/app-coding-standards/rules/ui-6-pin-initial-selection.md).

## Related Components

- `SelectionScreen` - Wrapper component that includes screen layout (1 section)
Expand Down
Loading