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

Font Loaded in <body> Not Applied to <input> Elements #76039

Open
githaka2025 opened this issue Feb 14, 2025 · 1 comment
Open

Font Loaded in <body> Not Applied to <input> Elements #76039

githaka2025 opened this issue Feb 14, 2025 · 1 comment
Labels
Font (next/font) Related to Next.js Font Optimization. please simplify reproduction Please simplify the reproduction. stale The issue has not seen recent activity.

Comments

@githaka2025
Copy link

Link to the code that reproduces this issue

https://github.com/githaka2025/volty/blob/main/src/components/shared/Input.tsx

To Reproduce

  1. Create a new Next.js project with a custom font using next/font.
  2. Apply the font to the element.
  3. Add an field to the page.
  4. Observe that the font is not applied to the field.

Current vs. Expected behavior

Current Behavior

When setting a custom font in Next.js by applying it to the <body> element, the font works as expected on most elements (e.g., <p>, <h1>, <div>, etc.), but it does not apply to <input> elements. Instead, <input> elements default to the system font unless explicitly styled.

Expected Behavior

The font defined on the <body> should cascade to all elements, including <input> fields, unless overridden by another CSS rule.

Actual Behavior

The font is correctly applied to text elements but not to fields, which continue to use the system default font. Manually setting the font on input elements via CSS (input { font-family: inherit; }) or via applying a class name as in the body fixes the issue.

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 10 Pro
  Available memory (MB): 8072
  Available CPU cores: 4
Binaries:
  Node: 22.11.0
  npm: 10.9.0
  Yarn: N/A
  pnpm: 10.3.0
Relevant Packages:
  next: 15.1.7 // Latest available version is detected (15.1.7).
  eslint-config-next: 15.1.7
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.7.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Font (next/font)

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

This might be caused by browsers setting font-family explicitly for form elements.
It would be helpful if next/font could automatically apply the font to form elements when assigned to the body.

@github-actions github-actions bot added the Font (next/font) Related to Next.js Font Optimization. label Feb 14, 2025
@samcx samcx added the please simplify reproduction Please simplify the reproduction. label Feb 14, 2025
Copy link
Contributor

We cannot easily recreate the issue with the provided information. Please add a minimal reproduction in order for us to be able to help more efficiently.

Why was this issue marked with the please simplify reproduction label?

There was a reproduction provided, but due to its complexity, we cannot easily reproduce the issue.

An ideal minimal reproduction (unless relevant):

  • is not part of a monorepo
  • does not require secrets to run
  • does not reference private registry dependencies
  • has as few dependencies as possible
  • excludes unrelated pages/routes
  • does not require a database/third-party service to run
  • only includes the code necessary to reproduce the issue
  • is tested against next@canary to make sure your issue has not already been fixed

In general, assume that we should not go through a lengthy onboarding process at your company code only to be able to verify an issue.

If you cannot create a clean reproduction, another way you can help the maintainers' job is to pinpoint the canary version of next that introduced the issue. Check out our releases, and try to find the first canary release that introduced the issue. This will help us narrow down the scope of the issue, and possibly point to the PR/code change that introduced it. You can install a specific version of next by running npm install next@<version>.

What happens if I don't provide a sufficient minimal reproduction?

Issues with the please simplify reproduction label that receive no meaningful activity (e.g. new comments with a simplified reproduction link) are automatically closed and locked after 14 days.

If your issue has not been resolved in that time and it has been closed/locked, please open a new issue with the required reproduction.

I did not open this issue, but it is relevant to me, what can I do to help?

Anyone experiencing the same issue is welcome to provide a minimal reproduction following the above steps.

I think my reproduction is good enough, why aren't you looking into it quicker?

We look into every Next.js issue and constantly monitor open issues for new comments.

However, sometimes we might miss one or two due to the popularity/high traffic of the repository. We apologize, and kindly ask you to refrain from tagging core maintainers, as that will usually not result in increased priority.

Providing a minimal reproduction from the start without asking helps us look into issues much more quickly, as we can easily verify if the reported bug is related to Next.js. That said, every issue is important to us, and if an issue gets closed by accident, we encourage you to open a new one linking to the old issue and we will look into it.

Useful Resources

@nextjs-bot nextjs-bot added the stale The issue has not seen recent activity. label Feb 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Font (next/font) Related to Next.js Font Optimization. please simplify reproduction Please simplify the reproduction. stale The issue has not seen recent activity.
Projects
None yet
Development

No branches or pull requests

3 participants