Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor attachments carousel actions on web #20261

Merged
merged 1 commit into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import {useEffect} from 'react';
import lodashGet from 'lodash/get';
import PropTypes from 'prop-types';
import KeyboardShortcut from '../../../libs/KeyboardShortcut';
import CONST from '../../../CONST';
import KeyboardShortcut from '../../libs/KeyboardShortcut';
import CONST from '../../CONST';

const propTypes = {
/** Callback to cycle through attachments */
Expand All @@ -13,7 +14,12 @@ const Carousel = (props) => {
const shortcutLeftConfig = CONST.KEYBOARD_SHORTCUTS.ARROW_LEFT;
const unsubscribeLeftKey = KeyboardShortcut.subscribe(
shortcutLeftConfig.shortcutKey,
() => {
(e) => {
if (lodashGet(e, 'target.blur')) {
// prevents focus from highlighting around the modal
e.target.blur();
}

props.onCycleThroughAttachments(-1);
},
shortcutLeftConfig.descriptionKey,
Expand All @@ -23,7 +29,12 @@ const Carousel = (props) => {
const shortcutRightConfig = CONST.KEYBOARD_SHORTCUTS.ARROW_RIGHT;
const unsubscribeRightKey = KeyboardShortcut.subscribe(
shortcutRightConfig.shortcutKey,
() => {
(e) => {
if (lodashGet(e, 'target.blur')) {
// prevents focus from highlighting around the modal
e.target.blur();
}

props.onCycleThroughAttachments(1);
},
shortcutRightConfig.descriptionKey,
Expand Down
42 changes: 0 additions & 42 deletions src/components/AttachmentCarousel/CarouselActions/index.js

This file was deleted.