Skip to content

Commit

Permalink
Make search result links <a> els
Browse files Browse the repository at this point in the history
- the only way to open them before was clicking on them; why not just make them standard anchors?
- was also very annoying not being able to middle click on them to open in new tabs
  • Loading branch information
poltak committed Jun 17, 2019
1 parent 91f18a9 commit aa78b10
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/common-ui/components/result-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,6 @@ class ResultItem extends PureComponent<Props> {
)
}

private handleClickOpenNewTab = (url: string) => (
e: React.MouseEvent<HTMLDivElement>,
) => {
window.open(url, '_blank').focus()
}

render() {
return (
<li
Expand All @@ -117,21 +111,22 @@ class ResultItem extends PureComponent<Props> {
.isResponsibleForSidebar,
})}
>
<div
<a
onDragStart={this.dragStart}
onDragEnd={this.props.resetUrlDragged}
className={cx(styles.root, {
[styles.rootOverview]: this.props.isOverview,
})}
onClick={this.handleClickOpenNewTab(this.hrefToPage)}
draggable
href={this.hrefToPage}
target="_blank"
>
{this.props.isSocial ? (
<SocialResultItem {...this.props} />
) : (
<PageResultItem {...this.props} />
)}
</div>
</a>
</div>
{this.props.tagManager}
{this.renderAnnotsList()}
Expand Down

0 comments on commit aa78b10

Please sign in to comment.