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

chore: updating header to use heading sm #29308

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

georgewrmarshall
Copy link
Contributor

@georgewrmarshall georgewrmarshall commented Dec 18, 2024

Description

This PR updates the header component text styling to use semantic HTML and consistent heading styles. The changes include:

  • Changed text element from <p> to <h2>
  • Updated text variant from bodyMdBold to headingSm
  • Improves accessibility by using proper heading hierarchy
  • Maintains consistent styling across multiple pages using the header component

Open in GitHub Codespaces

Related issues

Partially fixes: #29306

Manual testing steps

  1. Navigate to pages using the header component (NFT details, Connections, Permissions pages)
  2. Verify header text appears correctly with new heading styles
  3. Verify layout and alignment remain consistent
  4. Check that accessibility tools properly recognize the heading structure

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@georgewrmarshall georgewrmarshall added the team-design-system All issues relating to design system in Extension label Dec 18, 2024
@georgewrmarshall georgewrmarshall self-assigned this Dec 18, 2024
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

Comment on lines 20 to 22
<p
class="mm-box mm-text mm-text--body-md-bold mm-text--ellipsis mm-text--text-align-center mm-box--padding-inline-start-8 mm-box--padding-inline-end-8 mm-box--display-block mm-box--color-text-default"
<h2
class="mm-box mm-text mm-text--heading-sm mm-text--ellipsis mm-text--text-align-center mm-box--padding-inline-start-8 mm-box--padding-inline-end-8 mm-box--display-block mm-box--color-text-default"
/>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Add logic to remove the Text component if children is not present

@metamaskbot
Copy link
Collaborator

Builds ready [006e636]
Page Load Metrics (1543 ± 90 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint13882147154518890
domContentLoaded13652093151618287
load13882147154318790
domInteractive217636178
backgroundConnect9140283014
firstReactRender1596473115
getState4100212512
initialActions01000
loadScripts9681614112915474
setupStore611721
uiStartup157226771814301144
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 7 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [3392e3d]
Page Load Metrics (1472 ± 21 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1394158714824923
domContentLoaded1371155614624321
load1381156614724421
domInteractive238940199
backgroundConnect7221232
firstReactRender1465302110
getState34917178
initialActions01000
loadScripts1015119011054120
setupStore54710115
uiStartup15472103168310651
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: -103 Bytes (-0.00%)
  • common: 0 Bytes (0.00%)

Comment on lines -17 to -23
<div
class="mm-box"
>
<p
class="mm-box mm-text mm-text--body-md-bold mm-text--ellipsis mm-text--text-align-center mm-box--padding-inline-start-8 mm-box--padding-inline-end-8 mm-box--display-block mm-box--color-text-default"
/>
</div>
Copy link
Contributor Author

@georgewrmarshall georgewrmarshall Dec 29, 2024

Choose a reason for hiding this comment

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

Removes empty p and div tag when children is not present as in the example of the NFT details page header

Screenshot 2024-12-29 at 3 54 07 PM

as="h6"
variant={TextVariant.bodyMdMedium}
>
<Text onClick={toggleExpanded} variant={TextVariant.bodyMdMedium}>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removes incorrect h6 tag

Comment on lines +57 to +70
{children && (
<Text
as="h2"
display={Display.Block}
variant={TextVariant.headingSm}
textAlign={TextAlign.Center}
paddingInlineStart={8}
paddingInlineEnd={8}
ellipsis
{...textProps}
>
{children}
</Text>
)}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding logic to only render the h2 tag if children exist see ui/components/app/assets/nfts/nft-details/snapshots/nft-full-image.test.js.snap

@metamaskbot
Copy link
Collaborator

Builds ready [13f395b]
Page Load Metrics (1597 ± 38 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint39817531538270130
domContentLoaded1411175015767234
load1425176015977938
domInteractive23100462612
backgroundConnect106818136
firstReactRender1695342713
getState55320199
initialActions0442105
loadScripts1035131411826431
setupStore671222311
uiStartup16482205186715374

@@ -29,15 +29,11 @@ exports[`All Connections render renders correctly 1`] = `
<div
class="mm-box"
>
<p
class="mm-box mm-text mm-text--body-md-bold mm-text--ellipsis mm-text--text-align-center mm-box--padding-inline-start-8 mm-box--padding-inline-end-8 mm-box--display-block mm-box--color-text-default"
<h2
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updating to use heading sm and more correct semantic html

Comment on lines -80 to -86
<Text
as="span"
variant={TextVariant.headingMd}
textAlign={TextAlign.Center}
>
{t('permissions')}
</Text>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removing extra html element to reduce html bloat and to maintain heading consistency

@@ -28,11 +28,11 @@ exports[`SendPage render and initialization should render correctly even when a
<div
class="mm-box"
>
<h4
<h2
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updating header tag

@@ -28,11 +28,11 @@ exports[`Bridge renders the component with initial props 1`] = `
<div
class="mm-box"
>
<h4
<h2
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updating header tag

@metamaskbot
Copy link
Collaborator

Builds ready [8e748b5]
Page Load Metrics (1425 ± 22 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1353157414385828
domContentLoaded1336149614104522
load1345152114254622
domInteractive226033147
backgroundConnect84120115
firstReactRender1595282512
getState45014168
initialActions00000
loadScripts1002113210554019
setupStore683172110
uiStartup15122040169815976

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-design-system All issues relating to design system in Extension
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Standardize headers across the extension
2 participants