Skip to content

Conversation

RoyEJohnson
Copy link
Contributor

@RoyEJohnson RoyEJohnson commented Aug 13, 2025

CORE-20
CORE-459
The latter one describes using tab to get to the dialog, but we took a different approach (we want to be able to tab through the highlights without the detours, and use a different key to go into the editor).

@TomWoodward TomWoodward temporarily deployed to rex-web-core-20-highlig-7tndkq August 13, 2025 23:32 Inactive
@RoyEJohnson RoyEJohnson force-pushed the core-20-highlight-edit-navigation branch from f4806f7 to 4a38c4a Compare August 13, 2025 23:32
@TomWoodward TomWoodward temporarily deployed to rex-web-core-20-highlig-7tndkq August 13, 2025 23:32 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-core-20-highlig-7tndkq August 15, 2025 16:08 Inactive
@RoyEJohnson RoyEJohnson force-pushed the core-20-highlight-edit-navigation branch from 1683277 to 9f6495c Compare August 15, 2025 17:09
@TomWoodward TomWoodward temporarily deployed to rex-web-core-20-highlig-7tndkq August 15, 2025 17:09 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-core-20-highlig-7tndkq August 18, 2025 21:47 Inactive
@RoyEJohnson RoyEJohnson force-pushed the core-20-highlight-edit-navigation branch from 65e322d to 51bd861 Compare August 18, 2025 21:50
@TomWoodward TomWoodward temporarily deployed to rex-web-core-20-highlig-7tndkq August 18, 2025 21:50 Inactive
@RoyEJohnson RoyEJohnson force-pushed the core-20-highlight-edit-navigation branch from 51bd861 to 600cdff Compare August 18, 2025 22:06
@TomWoodward TomWoodward temporarily deployed to rex-web-core-20-highlig-7tndkq August 18, 2025 22:07 Inactive
@RoyEJohnson RoyEJohnson marked this pull request as ready for review August 18, 2025 22:10
@RoyEJohnson RoyEJohnson requested a review from a team as a code owner August 18, 2025 22:10
@RoyEJohnson RoyEJohnson requested a review from jivey August 18, 2025 22:10
display: flex;
align-items: center;
margin: 0;
padding: ${modalPadding * 0.5}rem 0;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Padding was doubled in the dialog title bar

.highlight {
position: relative;
z-index: 1;
user-select: none;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Prevent text selection in highlights, in particular by double-clicking, but overlapping highlights aren't allowed anyway, so this prevents error messages.

// Styling is expensive and most Cards don't need to render
function PreCard(props: CardProps) {
const computedProps = useComputedProps(props);
const hideUnfocusedEditCard = computedProps.annotation ? {} : {isHidden: !props.shouldFocusCard};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Edit card now only appears when making edits to the highlight/note

return [cardsHeights, onHeightChange] as const;
}

function rangeString({startOffset, endOffset}: Highlight['range']) {
Copy link
Contributor Author

@RoyEJohnson RoyEJohnson Aug 18, 2025

Choose a reason for hiding this comment

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

Functional changes are here through the end of useFocusedHighlight. There's a section below where most of the code was extracted to make the function, and replaced with a call to useFocusedHighlight. It's more obvious what I did if you look at the individual commit.


function useSaveAnnotation(
props: EditCardProps,
{ data, pageId, locationFilterId, highlight, onCancel }: EditCardProps,
Copy link
Contributor Author

@RoyEJohnson RoyEJohnson Aug 18, 2025

Choose a reason for hiding this comment

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

Just a bit of revising to props handling

loggedOut: boolean;
}

function useCloseAndTrack(closeFn: () => void) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some refactoring for clarity.

export const useFocusLost = (ref: React.RefObject<HTMLElement>, isEnabled: boolean, cb: () => void) => {
// eslint-disable-next-line react-hooks/exhaustive-deps
React.useEffect(onFocusInOrOutHandler(ref, isEnabled, cb, 'focusout'), [ref, isEnabled, cb]);
React.useEffect(() => onFocusInOrOutHandler(ref, isEnabled, cb, 'focusout')(), [ref, isEnabled, cb]);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

useEffect prefers to have an anonymous function, and this saves an eslint-disable comment

}
const highlight = highlights.find(h =>
h.elements && h.elements.some(el =>
h.elements && (h.elements as Element[]).some(el =>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This cast is better than using any below.

@TomWoodward TomWoodward temporarily deployed to rex-web-core-20-highlig-7tndkq August 20, 2025 16:06 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-core-20-highlig-7tndkq August 20, 2025 19:07 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-core-20-highlig-7tndkq August 20, 2025 19:58 Inactive
Copy link
Member

@jivey jivey left a comment

Choose a reason for hiding this comment

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

Changes seem good, but after using it, I'm worried the hidden highlight popup won't be discoverable enough. But we can get some feedback using the deployed env.

@TomWoodward TomWoodward temporarily deployed to rex-web-core-20-highlig-7tndkq August 21, 2025 18:50 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-core-20-highlig-7tndkq August 25, 2025 13:32 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-core-20-highlig-7tndkq August 25, 2025 21:19 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-core-20-highlig-7tndkq August 28, 2025 21:45 Inactive
@RoyEJohnson RoyEJohnson force-pushed the core-20-highlight-edit-navigation branch from ebc469f to 294aae1 Compare September 9, 2025 14:48
@RoyEJohnson
Copy link
Contributor Author

RoyEJohnson commented Sep 9, 2025

@jivey I have modified the highlight editor to show instructions (only) when a highlight is focused, to make the editor more discoverable.

@RoyEJohnson RoyEJohnson force-pushed the core-20-highlight-edit-navigation branch from 025bcab to a34e3f3 Compare September 9, 2025 22:51
@RoyEJohnson RoyEJohnson requested a review from jivey September 10, 2025 13:22
Copy link
Member

@jivey jivey left a comment

Choose a reason for hiding this comment

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

I see the help popup when unauthenticated, it seems a bit narrow though:
image

Otherwise I think this is good, and the keyboard interactions make a lot of sense.

@jivey
Copy link
Member

jivey commented Sep 16, 2025

@RoyEJohnson Something that just came to mind - if we always show the edit card while authenticated, is it odd that this message shows up? Because you can't edit it while unauthenticated?

If not authenticated, show login button
If no annotation, show instruction box
If annotation or edit-highight sequence has happened, show edit card
@RoyEJohnson RoyEJohnson force-pushed the core-20-highlight-edit-navigation branch from e537e1e to f3f4794 Compare September 18, 2025 17:56
@RoyEJohnson RoyEJohnson requested a review from jivey September 18, 2025 18:17
@RoyEJohnson
Copy link
Contributor Author

RoyEJohnson commented Sep 18, 2025

I had goofed it up: it wasn't supposed to always show the edit card. It should show

  • the login option if you're not logged in
  • instructions if there's no annotation
  • the edit card if there's an annotation or you've followed the instructions
    (now the JIRA test is being a pain)

@RoyEJohnson RoyEJohnson merged commit f4d7802 into main Sep 22, 2025
7 of 8 checks passed
@RoyEJohnson RoyEJohnson deleted the core-20-highlight-edit-navigation branch September 22, 2025 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants