Explorar el Código

Merge pull request #14291 from overleaf/ii-filetree-empty-space-click-2

Select project root folder

GitOrigin-RevId: 146bf9dcbfbd037c51529b80104495bd95922471
ilkin-overleaf hace 3 años
padre
commit
d8e2c10257

+ 7 - 1
services/web/frontend/js/features/file-tree/components/file-tree-context.js

@@ -15,6 +15,7 @@ function FileTreeContext({
   reindexReferences,
   reindexReferences,
   setRefProviderEnabled,
   setRefProviderEnabled,
   setStartedFreeTrial,
   setStartedFreeTrial,
+  setShouldShowVisualSelection,
   onSelect,
   onSelect,
   children,
   children,
 }) {
 }) {
@@ -23,9 +24,13 @@ function FileTreeContext({
       refProviders={refProviders}
       refProviders={refProviders}
       setRefProviderEnabled={setRefProviderEnabled}
       setRefProviderEnabled={setRefProviderEnabled}
       setStartedFreeTrial={setStartedFreeTrial}
       setStartedFreeTrial={setStartedFreeTrial}
+      setShouldShowVisualSelection={setShouldShowVisualSelection}
       reindexReferences={reindexReferences}
       reindexReferences={reindexReferences}
     >
     >
-      <FileTreeSelectableProvider onSelect={onSelect}>
+      <FileTreeSelectableProvider
+        onSelect={onSelect}
+        setShouldShowVisualSelection={setShouldShowVisualSelection}
+      >
         <FileTreeActionableProvider>
         <FileTreeActionableProvider>
           <FileTreeDraggableProvider>{children}</FileTreeDraggableProvider>
           <FileTreeDraggableProvider>{children}</FileTreeDraggableProvider>
         </FileTreeActionableProvider>
         </FileTreeActionableProvider>
@@ -39,6 +44,7 @@ FileTreeContext.propTypes = {
   refProviders: PropTypes.object.isRequired,
   refProviders: PropTypes.object.isRequired,
   setRefProviderEnabled: PropTypes.func.isRequired,
   setRefProviderEnabled: PropTypes.func.isRequired,
   setStartedFreeTrial: PropTypes.func.isRequired,
   setStartedFreeTrial: PropTypes.func.isRequired,
+  setShouldShowVisualSelection: PropTypes.func.isRequired,
   onSelect: PropTypes.func.isRequired,
   onSelect: PropTypes.func.isRequired,
   children: PropTypes.oneOfType([
   children: PropTypes.oneOfType([
     PropTypes.arrayOf(PropTypes.node),
     PropTypes.arrayOf(PropTypes.node),

+ 9 - 1
services/web/frontend/js/features/file-tree/components/file-tree-doc.js

@@ -8,9 +8,16 @@ import Icon from '../../../shared/components/icon'
 import iconTypeFromName from '../util/icon-type-from-name'
 import iconTypeFromName from '../util/icon-type-from-name'
 import classnames from 'classnames'
 import classnames from 'classnames'
 
 
-function FileTreeDoc({ name, id, isFile, isLinkedFile }) {
+function FileTreeDoc({
+  name,
+  id,
+  isFile,
+  isLinkedFile,
+  shouldShowVisualSelection,
+}) {
   const { isSelected, props: selectableEntityProps } = useSelectableEntity(
   const { isSelected, props: selectableEntityProps } = useSelectableEntity(
     id,
     id,
+    shouldShowVisualSelection,
     isFile
     isFile
   )
   )
 
 
@@ -38,6 +45,7 @@ FileTreeDoc.propTypes = {
   id: PropTypes.string.isRequired,
   id: PropTypes.string.isRequired,
   isFile: PropTypes.bool,
   isFile: PropTypes.bool,
   isLinkedFile: PropTypes.bool,
   isLinkedFile: PropTypes.bool,
+  shouldShowVisualSelection: PropTypes.bool,
 }
 }
 
 
 export const FileTreeIcon = ({ isLinkedFile, name }) => {
 export const FileTreeIcon = ({ isLinkedFile, name }) => {

+ 4 - 0
services/web/frontend/js/features/file-tree/components/file-tree-folder-list.js

@@ -12,6 +12,7 @@ function FileTreeFolderList({
   classes = {},
   classes = {},
   dropRef = null,
   dropRef = null,
   children,
   children,
+  shouldShowVisualSelection,
 }) {
 }) {
   files = files.map(file => ({ ...file, isFile: true }))
   files = files.map(file => ({ ...file, isFile: true }))
   const docsAndFiles = [...docs, ...files]
   const docsAndFiles = [...docs, ...files]
@@ -32,6 +33,7 @@ function FileTreeFolderList({
             folders={folder.folders}
             folders={folder.folders}
             docs={folder.docs}
             docs={folder.docs}
             files={folder.fileRefs}
             files={folder.fileRefs}
+            shouldShowVisualSelection={shouldShowVisualSelection}
           />
           />
         )
         )
       })}
       })}
@@ -43,6 +45,7 @@ function FileTreeFolderList({
             id={doc._id}
             id={doc._id}
             isFile={doc.isFile}
             isFile={doc.isFile}
             isLinkedFile={doc.linkedFileData && !!doc.linkedFileData.provider}
             isLinkedFile={doc.linkedFileData && !!doc.linkedFileData.provider}
+            shouldShowVisualSelection={shouldShowVisualSelection}
           />
           />
         )
         )
       })}
       })}
@@ -60,6 +63,7 @@ FileTreeFolderList.propTypes = {
   }),
   }),
   dropRef: PropTypes.func,
   dropRef: PropTypes.func,
   children: PropTypes.node,
   children: PropTypes.node,
+  shouldShowVisualSelection: PropTypes.bool,
 }
 }
 
 
 function compareFunction(one, two) {
 function compareFunction(one, two) {

+ 14 - 2
services/web/frontend/js/features/file-tree/components/file-tree-folder.js

@@ -14,10 +14,20 @@ import FileTreeItemInner from './file-tree-item/file-tree-item-inner'
 import FileTreeFolderList from './file-tree-folder-list'
 import FileTreeFolderList from './file-tree-folder-list'
 import usePersistedState from '../../../shared/hooks/use-persisted-state'
 import usePersistedState from '../../../shared/hooks/use-persisted-state'
 
 
-function FileTreeFolder({ name, id, folders, docs, files }) {
+function FileTreeFolder({
+  name,
+  id,
+  folders,
+  docs,
+  files,
+  shouldShowVisualSelection,
+}) {
   const { t } = useTranslation()
   const { t } = useTranslation()
 
 
-  const { isSelected, props: selectableEntityProps } = useSelectableEntity(id)
+  const { isSelected, props: selectableEntityProps } = useSelectableEntity(
+    id,
+    shouldShowVisualSelection
+  )
 
 
   const { selectedEntityParentIds } = useFileTreeSelectable(id)
   const { selectedEntityParentIds } = useFileTreeSelectable(id)
 
 
@@ -87,6 +97,7 @@ function FileTreeFolder({ name, id, folders, docs, files }) {
           docs={docs}
           docs={docs}
           files={files}
           files={files}
           dropRef={dropRefList}
           dropRef={dropRefList}
+          shouldShowVisualSelection={shouldShowVisualSelection}
         />
         />
       ) : null}
       ) : null}
     </>
     </>
@@ -99,6 +110,7 @@ FileTreeFolder.propTypes = {
   folders: PropTypes.array.isRequired,
   folders: PropTypes.array.isRequired,
   docs: PropTypes.array.isRequired,
   docs: PropTypes.array.isRequired,
   files: PropTypes.array.isRequired,
   files: PropTypes.array.isRequired,
+  shouldShowVisualSelection: PropTypes.bool,
 }
 }
 
 
 export default FileTreeFolder
 export default FileTreeFolder

+ 23 - 4
services/web/frontend/js/features/file-tree/components/file-tree-root.js

@@ -1,4 +1,4 @@
-import React, { useEffect } from 'react'
+import React, { useEffect, useState } from 'react'
 import PropTypes from 'prop-types'
 import PropTypes from 'prop-types'
 
 
 import withErrorBoundary from '../../../infrastructure/error-boundary'
 import withErrorBoundary from '../../../infrastructure/error-boundary'
@@ -31,6 +31,12 @@ const FileTreeRoot = React.memo(function FileTreeRoot({
   const { _id: projectId } = useProjectContext(projectContextPropTypes)
   const { _id: projectId } = useProjectContext(projectContextPropTypes)
   const { fileTreeData } = useFileTreeData()
   const { fileTreeData } = useFileTreeData()
   const isReady = projectId && fileTreeData
   const isReady = projectId && fileTreeData
+  const [shouldShowVisualSelection, setShouldShowVisualSelection] =
+    useState(true)
+
+  const handleFileTreeClick = () => {
+    setShouldShowVisualSelection(false)
+  }
 
 
   useEffect(() => {
   useEffect(() => {
     if (isReady) onInit()
     if (isReady) onInit()
@@ -42,14 +48,22 @@ const FileTreeRoot = React.memo(function FileTreeRoot({
       refProviders={refProviders}
       refProviders={refProviders}
       setRefProviderEnabled={setRefProviderEnabled}
       setRefProviderEnabled={setRefProviderEnabled}
       setStartedFreeTrial={setStartedFreeTrial}
       setStartedFreeTrial={setStartedFreeTrial}
+      setShouldShowVisualSelection={setShouldShowVisualSelection}
       reindexReferences={reindexReferences}
       reindexReferences={reindexReferences}
       onSelect={onSelect}
       onSelect={onSelect}
     >
     >
       {isConnected ? null : <div className="disconnected-overlay" />}
       {isConnected ? null : <div className="disconnected-overlay" />}
       <FileTreeToolbar />
       <FileTreeToolbar />
       <FileTreeContextMenu />
       <FileTreeContextMenu />
-      <div className="file-tree-inner">
-        <FileTreeRootFolder />
+      {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */}
+      <div
+        className="file-tree-inner"
+        onClick={handleFileTreeClick}
+        data-testid="file-tree-inner"
+      >
+        <FileTreeRootFolder
+          shouldShowVisualSelection={shouldShowVisualSelection}
+        />
       </div>
       </div>
       <FileTreeModalDelete />
       <FileTreeModalDelete />
       <FileTreeModalCreateFile />
       <FileTreeModalCreateFile />
@@ -59,7 +73,7 @@ const FileTreeRoot = React.memo(function FileTreeRoot({
   )
   )
 })
 })
 
 
-function FileTreeRootFolder() {
+function FileTreeRootFolder({ shouldShowVisualSelection }) {
   useFileTreeSocketListener()
   useFileTreeSocketListener()
   const { fileTreeData } = useFileTreeData()
   const { fileTreeData } = useFileTreeData()
 
 
@@ -75,6 +89,7 @@ function FileTreeRootFolder() {
         classes={{ root: 'file-tree-list' }}
         classes={{ root: 'file-tree-list' }}
         dropRef={dropRef}
         dropRef={dropRef}
         isOver={isOver}
         isOver={isOver}
+        shouldShowVisualSelection={shouldShowVisualSelection}
       >
       >
         <li className="bottom-buffer" />
         <li className="bottom-buffer" />
       </FileTreeFolderList>
       </FileTreeFolderList>
@@ -82,6 +97,10 @@ function FileTreeRootFolder() {
   )
   )
 }
 }
 
 
+FileTreeRootFolder.propTypes = {
+  shouldShowVisualSelection: PropTypes.bool,
+}
+
 FileTreeRoot.propTypes = {
 FileTreeRoot.propTypes = {
   onSelect: PropTypes.func.isRequired,
   onSelect: PropTypes.func.isRequired,
   onInit: PropTypes.func.isRequired,
   onInit: PropTypes.func.isRequired,

+ 29 - 7
services/web/frontend/js/features/file-tree/contexts/file-tree-selectable.js

@@ -75,7 +75,11 @@ function fileTreeSelectableReadOnlyReducer(selectedEntityIds, action) {
   }
   }
 }
 }
 
 
-export function FileTreeSelectableProvider({ onSelect, children }) {
+export function FileTreeSelectableProvider({
+  onSelect,
+  setShouldShowVisualSelection,
+  children,
+}) {
   const { _id: projectId, rootDocId } = useProjectContext(
   const { _id: projectId, rootDocId } = useProjectContext(
     projectContextPropTypes
     projectContextPropTypes
   )
   )
@@ -150,6 +154,7 @@ export function FileTreeSelectableProvider({ onSelect, children }) {
 
 
       dispatch({ type: ACTION_TYPES.SELECT, id: found.entity._id })
       dispatch({ type: ACTION_TYPES.SELECT, id: found.entity._id })
     }
     }
+
     window.addEventListener('editor.openDoc', handleOpenDoc)
     window.addEventListener('editor.openDoc', handleOpenDoc)
     return () => window.removeEventListener('editor.openDoc', handleOpenDoc)
     return () => window.removeEventListener('editor.openDoc', handleOpenDoc)
   }, [fileTreeData])
   }, [fileTreeData])
@@ -176,6 +181,7 @@ export function FileTreeSelectableProvider({ onSelect, children }) {
     select,
     select,
     unselect,
     unselect,
     selectOrMultiSelectEntity,
     selectOrMultiSelectEntity,
+    setShouldShowVisualSelection,
   }
   }
 
 
   return (
   return (
@@ -187,6 +193,7 @@ export function FileTreeSelectableProvider({ onSelect, children }) {
 
 
 FileTreeSelectableProvider.propTypes = {
 FileTreeSelectableProvider.propTypes = {
   onSelect: PropTypes.func.isRequired,
   onSelect: PropTypes.func.isRequired,
+  setShouldShowVisualSelection: PropTypes.func.isRequired,
   children: PropTypes.oneOfType([
   children: PropTypes.oneOfType([
     PropTypes.arrayOf(PropTypes.node),
     PropTypes.arrayOf(PropTypes.node),
     PropTypes.node,
     PropTypes.node,
@@ -202,20 +209,34 @@ const editorContextPropTypes = {
   permissionsLevel: PropTypes.oneOf(['readOnly', 'readAndWrite', 'owner']),
   permissionsLevel: PropTypes.oneOf(['readOnly', 'readAndWrite', 'owner']),
 }
 }
 
 
-export function useSelectableEntity(id, isFile) {
+export function useSelectableEntity(
+  id,
+  shouldShowVisualSelection = true,
+  isFile
+) {
   const { view, setView } = useLayoutContext(layoutContextPropTypes)
   const { view, setView } = useLayoutContext(layoutContextPropTypes)
-  const { selectedEntityIds, selectOrMultiSelectEntity } = useContext(
-    FileTreeSelectableContext
-  )
+  const {
+    selectedEntityIds,
+    selectOrMultiSelectEntity,
+    setShouldShowVisualSelection,
+  } = useContext(FileTreeSelectableContext)
 
 
   const isSelected = selectedEntityIds.has(id)
   const isSelected = selectedEntityIds.has(id)
 
 
   const handleEvent = useCallback(
   const handleEvent = useCallback(
     ev => {
     ev => {
+      ev.stopPropagation()
+      setShouldShowVisualSelection(true)
       selectOrMultiSelectEntity(id, ev.ctrlKey || ev.metaKey)
       selectOrMultiSelectEntity(id, ev.ctrlKey || ev.metaKey)
       setView(isFile ? 'file' : 'editor')
       setView(isFile ? 'file' : 'editor')
     },
     },
-    [id, selectOrMultiSelectEntity, setView, isFile]
+    [
+      id,
+      setShouldShowVisualSelection,
+      selectOrMultiSelectEntity,
+      setView,
+      isFile,
+    ]
   )
   )
 
 
   const handleClick = useCallback(
   const handleClick = useCallback(
@@ -244,7 +265,8 @@ export function useSelectableEntity(id, isFile) {
     [id, handleEvent, selectedEntityIds]
     [id, handleEvent, selectedEntityIds]
   )
   )
 
 
-  const isVisuallySelected = isSelected && view !== 'pdf'
+  const isVisuallySelected =
+    shouldShowVisualSelection && isSelected && view !== 'pdf'
   const props = useMemo(
   const props = useMemo(
     () => ({
     () => ({
       className: classNames({ selected: isVisuallySelected }),
       className: classNames({ selected: isVisuallySelected }),

+ 2 - 2
services/web/frontend/js/features/history/components/file-tree/history-file-tree-doc.tsx

@@ -9,7 +9,7 @@ type HistoryFileTreeDocProps = {
   file: FileDiff
   file: FileDiff
   name: string
   name: string
   selected: boolean
   selected: boolean
-  onClick: (file: FileDiff) => void
+  onClick: (file: FileDiff, event: React.MouseEvent<HTMLLIElement>) => void
   onKeyDown: (file: FileDiff, event: React.KeyboardEvent<HTMLLIElement>) => void
   onKeyDown: (file: FileDiff, event: React.KeyboardEvent<HTMLLIElement>) => void
 }
 }
 
 
@@ -24,7 +24,7 @@ function HistoryFileTreeDoc({
     <li
     <li
       role="treeitem"
       role="treeitem"
       className={classNames({ selected })}
       className={classNames({ selected })}
-      onClick={() => onClick(file)}
+      onClick={e => onClick(file, e)}
       onKeyDown={e => onKeyDown(file, e)}
       onKeyDown={e => onKeyDown(file, e)}
       aria-selected={selected}
       aria-selected={selected}
       aria-label={name}
       aria-label={name}

+ 24 - 7
services/web/frontend/js/features/history/components/file-tree/history-file-tree-folder-list.tsx

@@ -21,10 +21,21 @@ function HistoryFileTreeFolderList({
   rootClassName,
   rootClassName,
   children,
   children,
 }: HistoryFileTreeFolderListProps) {
 }: HistoryFileTreeFolderListProps) {
-  const { selection, setSelection } = useHistoryContext()
+  const {
+    selection,
+    setSelection,
+    shouldShowVisualSelection,
+    setShouldShowVisualSelection,
+  } = useHistoryContext()
+
+  const handleTopLevelClick = () => {
+    setShouldShowVisualSelection(false)
+  }
 
 
   const handleEvent = useCallback(
   const handleEvent = useCallback(
-    (file: FileDiff) => {
+    (file: FileDiff, event: React.UIEvent) => {
+      event.stopPropagation()
+      setShouldShowVisualSelection(true)
       setSelection(prevSelection => {
       setSelection(prevSelection => {
         if (file.pathname !== prevSelection.selectedFile?.pathname) {
         if (file.pathname !== prevSelection.selectedFile?.pathname) {
           return {
           return {
@@ -37,12 +48,12 @@ function HistoryFileTreeFolderList({
         return prevSelection
         return prevSelection
       })
       })
     },
     },
-    [setSelection]
+    [setSelection, setShouldShowVisualSelection]
   )
   )
 
 
   const handleClick = useCallback(
   const handleClick = useCallback(
-    (file: FileDiff) => {
-      handleEvent(file)
+    (file: FileDiff, event: React.MouseEvent<HTMLLIElement>) => {
+      handleEvent(file, event)
     },
     },
     [handleEvent]
     [handleEvent]
   )
   )
@@ -50,14 +61,19 @@ function HistoryFileTreeFolderList({
   const handleKeyDown = useCallback(
   const handleKeyDown = useCallback(
     (file: FileDiff, event: React.KeyboardEvent<HTMLLIElement>) => {
     (file: FileDiff, event: React.KeyboardEvent<HTMLLIElement>) => {
       if (event.key === 'Enter' || event.key === ' ') {
       if (event.key === 'Enter' || event.key === ' ') {
-        handleEvent(file)
+        handleEvent(file, event)
       }
       }
     },
     },
     [handleEvent]
     [handleEvent]
   )
   )
 
 
   return (
   return (
-    <ul className={classNames('list-unstyled', rootClassName)} role="tree">
+    // eslint-disable-next-line jsx-a11y/click-events-have-key-events
+    <ul
+      className={classNames('list-unstyled', rootClassName)}
+      role="tree"
+      onClick={handleTopLevelClick}
+    >
       {folders.map(folder => (
       {folders.map(folder => (
         <HistoryFileTreeFolder
         <HistoryFileTreeFolder
           key={folder.name}
           key={folder.name}
@@ -72,6 +88,7 @@ function HistoryFileTreeFolderList({
           name={doc.name}
           name={doc.name}
           file={doc}
           file={doc}
           selected={
           selected={
+            shouldShowVisualSelection &&
             !!selection.selectedFile &&
             !!selection.selectedFile &&
             fileFinalPathname(selection.selectedFile) === doc.pathname
             fileFinalPathname(selection.selectedFile) === doc.pathname
           }
           }

+ 6 - 0
services/web/frontend/js/features/history/context/history-context.tsx

@@ -88,6 +88,8 @@ function useHistory() {
   const currentUserIsOwner = projectOwnerId === userId
   const currentUserIsOwner = projectOwnerId === userId
 
 
   const [selection, setSelection] = useState<Selection>(selectionInitialState)
   const [selection, setSelection] = useState<Selection>(selectionInitialState)
+  const [shouldShowVisualSelection, setShouldShowVisualSelection] =
+    useState(true)
 
 
   const [updatesInfo, setUpdatesInfo] = useState<
   const [updatesInfo, setUpdatesInfo] = useState<
     HistoryContextValue['updatesInfo']
     HistoryContextValue['updatesInfo']
@@ -330,6 +332,8 @@ function useHistory() {
       setSelection,
       setSelection,
       fetchNextBatchOfUpdates,
       fetchNextBatchOfUpdates,
       resetSelection,
       resetSelection,
+      shouldShowVisualSelection,
+      setShouldShowVisualSelection,
     }),
     }),
     [
     [
       loadingFileDiffs,
       loadingFileDiffs,
@@ -346,6 +350,8 @@ function useHistory() {
       setSelection,
       setSelection,
       fetchNextBatchOfUpdates,
       fetchNextBatchOfUpdates,
       resetSelection,
       resetSelection,
+      shouldShowVisualSelection,
+      setShouldShowVisualSelection,
     ]
     ]
   )
   )
 
 

+ 4 - 0
services/web/frontend/js/features/history/context/types/history-context-value.ts

@@ -31,4 +31,8 @@ export type HistoryContextValue = {
   >
   >
   fetchNextBatchOfUpdates: () => (() => void) | void
   fetchNextBatchOfUpdates: () => (() => void) | void
   resetSelection: () => void
   resetSelection: () => void
+  shouldShowVisualSelection: boolean
+  setShouldShowVisualSelection: React.Dispatch<
+    React.SetStateAction<HistoryContextValue['shouldShowVisualSelection']>
+  >
 }
 }

+ 34 - 0
services/web/test/frontend/features/file-tree/components/file-tree-root.test.js

@@ -305,4 +305,38 @@ describe('<FileTreeRoot/>', function () {
     // multiple items selected: no menu button is visible
     // multiple items selected: no menu button is visible
     expect(screen.queryAllByRole('button', { name: 'Menu' })).to.have.length(0)
     expect(screen.queryAllByRole('button', { name: 'Menu' })).to.have.length(0)
   })
   })
+
+  it('deselects files when clicked outside the list but inside wrapping container', function () {
+    const rootFolder = [
+      {
+        _id: 'root-folder-id',
+        name: 'rootFolder',
+        docs: [{ _id: '456def', name: 'main.tex' }],
+        folders: [],
+        fileRefs: [],
+      },
+    ]
+    renderWithEditorContext(
+      <FileTreeRoot
+        refProviders={{}}
+        reindexReferences={() => null}
+        setRefProviderEnabled={() => null}
+        setStartedFreeTrial={() => null}
+        onSelect={onSelect}
+        onInit={onInit}
+        isConnected
+      />,
+      {
+        rootFolder,
+        projectId: '123abc',
+        rootDocId: '456def',
+        features: {},
+        permissionsLevel: 'owner',
+      }
+    )
+
+    screen.getByRole('treeitem', { selected: true })
+    fireEvent.click(screen.getByTestId('file-tree-inner'))
+    expect(screen.queryByRole('treeitem', { selected: true })).to.be.null
+  })
 })
 })

+ 3 - 0
services/web/test/frontend/features/file-tree/helpers/render-with-context.js

@@ -24,6 +24,7 @@ export default (children, options = {}) => {
     setStartedFreeTrial: () => {
     setStartedFreeTrial: () => {
       console.log('started free trial')
       console.log('started free trial')
     },
     },
+    setShouldShowVisualSelection: () => {},
     onSelect: () => {},
     onSelect: () => {},
     ...contextProps,
     ...contextProps,
   }
   }
@@ -32,6 +33,7 @@ export default (children, options = {}) => {
     reindexReferences,
     reindexReferences,
     setRefProviderEnabled,
     setRefProviderEnabled,
     setStartedFreeTrial,
     setStartedFreeTrial,
+    setShouldShowVisualSelection,
     onSelect,
     onSelect,
     ...editorContextProps
     ...editorContextProps
   } = contextProps
   } = contextProps
@@ -41,6 +43,7 @@ export default (children, options = {}) => {
       reindexReferences={reindexReferences}
       reindexReferences={reindexReferences}
       setRefProviderEnabled={setRefProviderEnabled}
       setRefProviderEnabled={setRefProviderEnabled}
       setStartedFreeTrial={setStartedFreeTrial}
       setStartedFreeTrial={setStartedFreeTrial}
+      setShouldShowVisualSelection={setShouldShowVisualSelection}
       onSelect={onSelect}
       onSelect={onSelect}
     >
     >
       {children}
       {children}