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

webui: Improve UI of links for viewing search results in context. #515

Merged
merged 1 commit into from
Aug 19, 2024
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
Expand Up @@ -50,3 +50,12 @@
word-break: break-word;
}

.search-results-file-link {
margin-top: 0.25rem;

color: grey;
font-family: 'Roboto', sans-serif;
font-size: 0.875rem;
font-weight: 400;
line-height: 1.5;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import Table from "react-bootstrap/Table";
import dayjs from "dayjs";

import {
faFileLines,
faSort,
faSortDown,
faSortUp,
faSquareUpRight,
} from "@fortawesome/free-solid-svg-icons";
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";

Expand Down Expand Up @@ -125,10 +125,6 @@ const SearchResultsTable = ({
Log message
</div>
</th>
{isExtractIrSupported &&
<th className={"search-results-th"}>
<div className={"search-results-table-header"}>&nbsp;</div>
</th>}
</tr>
</thead>
<tbody>
Expand All @@ -143,20 +139,23 @@ const SearchResultsTable = ({
<pre className={"search-results-content search-results-message"}>
{result.message}
</pre>
{isExtractIrSupported &&
<div className={"search-results-file-link"}>
<FontAwesomeIcon icon={faFileLines}/>
{" "}
<a
className={"search-results-file-link"}
rel={"noopener noreferrer"}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reasoning behind setting these? Fwiw, _blank seems to imply noopener now:

Note: Setting target="_blank" on elements implicitly provides the same rel behavior as setting rel="noopener" which does not set window.opener.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah.. I didn't read the docs when I wrote this.

Apparently the behaviour change is fairly recent (with Chrome adapting it only since 2021) so we might better keep the noopener:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#browser_compatibility:~:text=target%3D%22_blank%22%20implies%20rel%3D%22noopener%22%20behavior

target={"_blank"}
title={"View log event in context"}
href={`${Meteor.settings.public.LogViewerWebuiUrl
}?origFileId=${result.orig_file_id}` +
`&logEventIdx=${result.log_event_ix}`}
>
{result.orig_file_path}
</a>
</div>}
</td>
{isExtractIrSupported &&
<td>
<a
rel={"noopener noreferrer"}
target={"_blank"}
title={"View log event in context"}
href={`${Meteor.settings.public.LogViewerWebuiUrl
}?origFileId=${result.orig_file_id}` +
`&logEventIdx=${result.log_event_ix}`}
>
<FontAwesomeIcon icon={faSquareUpRight}/>
</a>
</td>}
</tr>
))}
</tbody>
Expand Down