Skip to content

feat(popup): restyle popups - #5351

Draft
dastarruer wants to merge 9 commits into
readest:mainfrom
dastarruer:feat/restyle-popup
Draft

feat(popup): restyle popups#5351
dastarruer wants to merge 9 commits into
readest:mainfrom
dastarruer:feat/restyle-popup

Conversation

@dastarruer

Copy link
Copy Markdown
Contributor

Closes #5267.

Screenshots

Dark mode

image image image

Light mode

image image image

@dastarruer
dastarruer marked this pull request as ready for review July 27, 2026 01:11
@dastarruer dastarruer changed the title [WIP] feat(popup): restyle popup feat(popup): restyle popups Jul 27, 2026
@dastarruer

dastarruer commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

More screenshots!

Dark mode

image image image

Light mode

(Just realized I need to style the highlight type buttons, but here's a screenshot nonetheless):
image

image image

@dastarruer

dastarruer commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

How do I update the tests so checks pass? (Pre-push hook passed on my machine so I didn't realize my mistake)

@chrox

chrox commented Jul 27, 2026

Copy link
Copy Markdown
Member

Remove the PNG files that serve as the reference images for the highlight rendering tests. Running pnpm test:browser on your local machine will regenerate them. Once you commit the regenerated images, the CI will use them as the new baseline for rendering comparisons.

@chrox

chrox commented Jul 27, 2026

Copy link
Copy Markdown
Member

Light mode

(Just realized I need to style the highlight type buttons, but here's a screenshot nonetheless):

image

Yes, it should be restyled with theme colors too.

@dastarruer
dastarruer marked this pull request as draft July 27, 2026 01:53
@dastarruer

Copy link
Copy Markdown
Contributor Author
image

Also realized that these toggles look reversed, so I'll need to fix that as well before this can be merged.

const innerTriangleStyles = getTriangleStyles(trianglePosition, 7, -1);

const popupHeight = height ?? childrenHeight;
const triangleHidden = !!(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If this is removed, triangle might be drawn at a place where no text is selected, especially when the popup is higher than half of the screen and the selected text is at the center of the screen, it could be reproduced with the dictionary popup on smaller screens.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

2026-07-27.10-50-02.mp4

Can't seem to replicate it. Is this what you meant?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This can be reproduced with a wider but lower window so that the popup is a modal instead of an action sheet.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I can't reproduce it at all:

image

If you can, please send a screenshot so I know what you're talking about.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

image image image

Note that for the 'floated' word, the triangle is hidden otherwise it will be drawn at a wrong place.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Still can't reproduce it. But the reason I removed it was to fix a visual bug:

image

I'll see if I can't work around it, but I don't really know why this is happening.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The triangle color might be hardcoded to gray-500.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Doesn't seem to be the case anywhere. The effect I'm trying to get (which you can see in the screenshots) only seems to work once both inner and outer triangles are set to z-50.

Again, can't seem to reproduce the bug. Maybe instead of hiding the triangle all popups could get a fixed height, so the triangle never needs to be hidden? Either way will keep working at it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Again, can't seem to reproduce the bug. Maybe instead of hiding the triangle all popups could get a fixed height, so the triangle never needs to be hidden? Either way will keep working at it.

There are still cases where the popup is more than half the height of the window. When the selected text is near the center of the window, the popup’s pointer triangle can therefore be misplaced. It will be reproducible with a higher popup.

@dastarruer

Copy link
Copy Markdown
Contributor Author

Yes, it should be restyled with theme colors too.

I took the liberty of redoing the buttons instead:

image

Mostly taken from gdocs:

image

@dastarruer
dastarruer force-pushed the feat/restyle-popup branch from 7db5f38 to afd202e Compare July 28, 2026 16:59
@chrox

chrox commented Jul 28, 2026

Copy link
Copy Markdown
Member
image

Please keep the original highlight style, it was much better than this.

image

This may be an existing issue, but the shape should be a perfect circle.

@dastarruer

Copy link
Copy Markdown
Contributor Author
image Please keep the original highlight style, it was much better than this.

The original style had poor contrast:

image

Since the user can choose literally any color, choosing a text color that properly contrasts is difficult. Hence, I took the approach that gdocs does, and just made it a colored underline.

image This may be an existing issue, but the shape should be a perfect circle.

Yes, I’ll fix this. It was an issue introduced by this pr.

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.

Popup backgrounds aren't themed with the rest of the app

2 participants