Skip to content

Commit 61df519

Browse files
Merge branch 'main' into tylerjdev/replace-deprecated-buttons-dialog
2 parents 8d731aa + caa91bb commit 61df519

File tree

4 files changed

+61
-27
lines changed

4 files changed

+61
-27
lines changed

.changeset/empty-starfishes-relate.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/react': patch
3+
---
4+
5+
Tooltip2: Do not wrap the tooltip span and its trigger in a div

.github/workflows/deploy_preview.yml

Lines changed: 45 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,61 @@
1-
name: Deploy
1+
name: Deploy Preview
22
on:
33
pull_request:
44

5-
permissions:
6-
contents: read
7-
pages: write
8-
id-token: write
9-
deployments: write
10-
statuses: write
11-
checks: write
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.ref }}
7+
cancel-in-progress: true
128

139
jobs:
10+
build:
11+
if: ${{ github.repository == 'primer/react' }}
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
- name: Set up Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: 20
20+
cache: 'npm'
21+
- name: Install dependencies
22+
run: npm ci
23+
- name: Install docs dependencies
24+
run: npm ci --legacy-peer-deps
25+
working-directory: docs
26+
- name: Build docs preview
27+
run: npm run build:docs:preview
28+
- uses: actions/upload-pages-artifact@v2
29+
with:
30+
name: github-pages
31+
path: docs/public
32+
1433
deploy-preview:
15-
# if the source repository for pull request is a fork, we don't want to run this workflow,
16-
# we run deploy_preview_forks.yml which uses pull_request_target instead.
17-
# see https://github.com/primer/react/pull/2207 for details
18-
if: ${{ github.event.pull_request.head.repo.full_name == 'primer/react' }} # source repository for pull_request
19-
name: Preview
20-
uses: primer/.github/.github/workflows/deploy_preview.yml@0cec9b9914f358846163f2428663b58da41028c9
34+
if: ${{ github.repository == 'primer/react' }}
35+
needs: build
2136
permissions:
22-
contents: read
2337
pages: write
2438
id-token: write
25-
secrets:
26-
gh_token: ${{ secrets.GITHUB_TOKEN }}
27-
with:
28-
node_version: 18
29-
install: npm ci && cd docs && npm ci --legacy-peer-deps && cd ..
30-
build: npm run build:docs:preview
31-
output_dir: docs/public
39+
environment:
40+
name: github-pages
41+
url: ${{ steps.deployment.outputs.page_url }}
42+
outputs:
43+
deployment_url: ${{ steps.deployment.outputs.page_url }}
44+
runs-on: ubuntu-latest
45+
steps:
46+
- name: Deploy to GitHub Pages
47+
id: deployment
48+
uses: actions/deploy-pages@v3
49+
with:
50+
preview: true
3251

3352
deploy-storybook:
34-
if: ${{ github.repository == 'primer/react' }}
3553
name: Preview Storybook
36-
runs-on: ubuntu-latest
54+
if: ${{ github.repository == 'primer/react' }}
3755
needs: deploy-preview
56+
permissions:
57+
deployments: write
58+
runs-on: ubuntu-latest
3859
steps:
3960
- uses: chrnorm/[email protected]
4061
name: Create GitHub deployment for storybook

src/ActionList/Item.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const InactiveIndicator: React.FC<{
3434
padding: 0,
3535
font: 'inherit',
3636
cursor: 'pointer',
37+
display: 'flex',
3738
}}
3839
aria-labelledby={labelId}
3940
>

src/drafts/Tooltip/Tooltip.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React, {Children, useEffect, useRef, useState} from 'react'
2-
import Box from '../../Box'
32
import sx, {SxProp} from '../../sx'
43
import {useId, useProvidedRefOrCreate} from '../../hooks'
54
import {invariant} from '../../utils/invariant'
@@ -139,6 +138,7 @@ export type TriggerPropsType = {
139138
onBlur?: React.FocusEventHandler
140139
onFocus?: React.FocusEventHandler
141140
onMouseEnter?: React.MouseEventHandler
141+
onMouseLeave?: React.MouseEventHandler
142142
ref?: React.RefObject<HTMLElement>
143143
}
144144

@@ -268,7 +268,7 @@ export const Tooltip = React.forwardRef(
268268

269269
return (
270270
<TooltipContext.Provider value={{tooltipId}}>
271-
<Box onMouseLeave={() => closeTooltip()}>
271+
<>
272272
{React.isValidElement(child) &&
273273
React.cloneElement(child as React.ReactElement<TriggerPropsType>, {
274274
ref: triggerRef,
@@ -288,6 +288,10 @@ export const Tooltip = React.forwardRef(
288288
openTooltip()
289289
child.props.onMouseEnter?.(event)
290290
},
291+
onMouseLeave: (event: React.MouseEvent) => {
292+
closeTooltip()
293+
child.props.onMouseLeave?.(event)
294+
},
291295
})}
292296
<StyledTooltip
293297
ref={tooltipElRef}
@@ -298,10 +302,13 @@ export const Tooltip = React.forwardRef(
298302
// stop AT from announcing the tooltip twice when it is a label type because it will be announced with "aria-labelledby"
299303
aria-hidden={type === 'label' ? true : undefined}
300304
id={`tooltip-${tooltipId}`}
305+
// mouse leave and enter on the tooltip itself is needed to keep the tooltip open when the mouse is over the tooltip
306+
onMouseEnter={openTooltip}
307+
onMouseLeave={closeTooltip}
301308
>
302309
{text}
303310
</StyledTooltip>
304-
</Box>
311+
</>
305312
</TooltipContext.Provider>
306313
)
307314
},

0 commit comments

Comments
 (0)