Skip to content

Conversation

@six7
Copy link
Contributor

@six7 six7 commented Nov 6, 2023

Fixes an issue with MarkdownEditor's focus token usage that wasn't picked up causing focus to not be visible part of #3901 as well as an issue that caused the borderBottom for the Preview tab to not be visible.

Before:

CleanShot.2023-11-06.at.10.20.19.mp4

##After:

CleanShot.2023-11-06.at.10.20.42.mp4

Changelog

Changed

  • Fetched the right token using the theme function, as the variable itself seems like it's no longer available
  • Added styles to make sure the Preview tab has a borderBottom

Rollout strategy

  • Patch release (if possible still part of Release tracking #3901)
  • Minor release
  • Major release; if selected, include a written rollout or migration plan

Testing & Reviewing

Head to http://127.0.0.1:6006/?path=/story/drafts-components-markdowneditor--playground and focus the text area or navigate to the Preview tab

Merge checklist

Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.

@changeset-bot
Copy link

changeset-bot bot commented Nov 6, 2023

⚠️ No Changeset found

Latest commit: b3e3c81

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2023

size-limit report 📦

Path Size
dist/browser.esm.js 104.06 KB (0%)
dist/browser.umd.js 104.61 KB (0%)

@six7 six7 added the skip changeset This change does not need a changelog label Nov 6, 2023
@github-actions github-actions bot temporarily deployed to storybook-preview-3911 November 6, 2023 09:32 Inactive
@six7 six7 marked this pull request as ready for review November 6, 2023 09:35
@six7 six7 requested review from a team and pksjce November 6, 2023 09:35
Copy link
Member

@siddharthkp siddharthkp left a comment

Choose a reason for hiding this comment

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

Left an optional improvement, approving in advance

@github-actions github-actions bot temporarily deployed to storybook-preview-3911 November 6, 2023 11:11 Inactive
Copy link
Contributor

@iansan5653 iansan5653 left a comment

Choose a reason for hiding this comment

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

Sweet - I'd love to cut a release after we merge this so we can ship these updates in dotcom.

Comment on lines 403 to 409
'&: focus-within':
view === 'edit'
? {
outline: '2px solid var(--borderColor-accent-emphasis)',
outline: '2px solid',
outlineColor: 'accent.emphasis',
}
: {},
Copy link
Contributor

@iansan5653 iansan5653 Nov 6, 2023

Choose a reason for hiding this comment

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

I think this is non-blocking since it feels like something we can tweak later, but the PVC component only shows focus on the whole editor when the textarea is focused. When focus is on the toolbar, the blue outline around the editor is not rendered. For example:

Screenshot of PVC commentbox with focus on a toolbar button. One blue outline is visible around that button.

The same is not true for this component, where we show the outline whenever focus is anywhere inside the editor:

Screenshot of React commentbox with focus on a toolbar button. Two blue outlines are visible: one around the button and one around the entire commentbox region.

The problem is how we would do this: has would be the perfect solution here (&:has(textarea:focus), but browser support is not there (thanks Firefox). Maybe it's worth waiting for browser support rather than rolling some custom React state-based solution.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we capture this in a new issue? It seems like Firefox will support :has by Christmas: https://groups.google.com/a/mozilla.org/g/dev-platform/c/oacuvZ2_hLg/m/4o28pFLkAwAJ?pli=1 🎉

Copy link
Member

Choose a reason for hiding this comment

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

Oh that's interesting. We already use :has in primer/react in a few places. I'm assuming this is because dotcom uses a polyfill

@six7 six7 added this pull request to the merge queue Nov 6, 2023
Merged via the queue into main with commit ef8d5bd Nov 6, 2023
@six7 six7 deleted the fix/markdowneditor-focus-outline branch November 6, 2023 15:25
broccolinisoup added a commit that referenced this pull request Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip changeset This change does not need a changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants