MCPcopy Create free account
hub / github.com/adobe/react-spectrum / home

Function home

packages/react-aria/src/selection/useSelectableCollection.ts:251–270  ·  view source on GitHub ↗
(e: KeyboardEvent)

Source from the content-addressed store, hash-verified

249 };
250
251 let home = (e: KeyboardEvent) => {
252 if (delegate.getFirstKey) {
253 if (manager.focusedKey === null && e.shiftKey) {
254 return false;
255 }
256 // TODO: should Home and End also be reversed in column reverse aka Home goes to top? Or should Home always to to the "first" (bottom)
257 let firstKey: Key | null = delegate.getFirstKey(manager.focusedKey, isCtrlKeyPressed(e));
258 manager.setFocusedKey(firstKey);
259 if (firstKey != null) {
260 if (isCtrlKeyPressed(e) && e.shiftKey && manager.selectionMode === 'multiple') {
261 manager.extendSelection(firstKey);
262 return;
263 } else if (selectOnFocus) {
264 manager.replaceSelection(firstKey);
265 return;
266 }
267 }
268 }
269 return false;
270 };
271
272 let arrowLeft = (e: KeyboardEvent) => {
273 if (delegate.getKeyLeftOf) {

Callers

nothing calls this directly

Calls 5

isCtrlKeyPressedFunction · 0.90
getFirstKeyMethod · 0.65
setFocusedKeyMethod · 0.65
extendSelectionMethod · 0.65
replaceSelectionMethod · 0.65

Tested by

no test coverage detected