Skip to content

Commit

Permalink
Fix bubbling up of events from the space picker search box while reta…
Browse files Browse the repository at this point in the history
…ining the arrow navigation
  • Loading branch information
blackforestboi committed Jul 25, 2024
1 parent 72472f4 commit f3ed1f8
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@ export class PickerSearchInput extends React.Component<Props, State> {
value={this.props.value}
onChange={this.onChange}
onKeyDown={(e) => {
this.props.onKeyDown(e)
e.stopPropagation()
this.props.onKeyDown(e)
}}
onKeyUp={(event) => {
event.stopPropagation()
}}
type={'input'}
componentRef={this.props.searchInputRef}
Expand Down
5 changes: 4 additions & 1 deletion src/custom-lists/ui/CollectionPicker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ class SpacePicker extends StatefulUIElement<
}

private handleKeyPress = (event: React.KeyboardEvent<HTMLInputElement>) => {
event.stopPropagation()
this.processEvent('keyPress', { event })
}

Expand Down Expand Up @@ -863,7 +864,9 @@ class SpacePicker extends StatefulUIElement<
this.state.selectedListIds.length === 0
}
onChange={this.handleSearchInputChanged}
onKeyDown={this.handleKeyPress}
onKeyDown={(event) => {
this.handleKeyPress(event)
}}
value={this.state.query}
autoFocus={
this.state.listIdToShowNewChildInput ||
Expand Down
3 changes: 1 addition & 2 deletions src/custom-lists/ui/CollectionPicker/logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ export default class SpacePickerLogic extends UILogic<
event: { event },
previousState,
}) => {
event.stopPropagation()
if (event.key === 'Enter') {
const isCmdKey = event.metaKey || event.ctrlKey
await this.handleEnterKeyPress(previousState, isCmdKey)
Expand Down Expand Up @@ -574,8 +575,6 @@ export default class SpacePickerLogic extends UILogic<
this.dependencies.closePicker(event)
return
}

event.stopPropagation()
}

openListInWebUI: EventHandler<'openListInWebUI'> = async ({ event }) => {
Expand Down
3 changes: 3 additions & 0 deletions src/custom-lists/ui/space-edit-menu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ export default class SpaceEditMenuContainer extends StatefulUIElement<
onKeyDown={
this.handleNameEditInputKeyDown
}
onKeyUp={(event) => {
event.stopPropagation()
}}
autoFocus
/>
</Container>
Expand Down
3 changes: 3 additions & 0 deletions src/custom-lists/ui/space-email-invites/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ export default class SpaceEmailInvites extends StatefulUIElement<
: null
}
onKeyDown={this.handleAddInviteInputKeyDown}
onKeyUp={(event) => {
event.stopPropagation()
}}
/>
{this.shouldShowInviteBtn &&
this.state.emailInvitesCreateState !== 'running' &&
Expand Down

0 comments on commit f3ed1f8

Please sign in to comment.