Skip to content

馃拝 noUnknownAttribute do not recognize closedby as a valid attribute for <dialog>#9141

Description

@THernandez03

Environment information

Description

When enabling the noUnknownAttribute rule, Biome reports the closedby attribute on the <dialog> element as an unknown attribute.

However, closedby is a valid HTML attribute for <dialog>, as documented in the MDN reference:
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/dialog

This results in false positives, warning users about attributes that are actually part of the HTML specification.

Current Behavior

The linter flags closedby as an unknown attribute when used on a <dialog> element.

See the playground

This triggers a noUnknownAttribute warning.

Expected Behavior

The noUnknownAttribute rule should:

  • Warn only about truly unknown or invalid attributes
  • Accept valid attributes defined for each HTML element, including closedby on <dialog>

Possible solution

By inspecting the implementation, the issue appears to come from a missing entry in the attribute map.

In this file:

const ATTRIBUTE_TAGS_MAP: &[(&str, &[&str])] = &[

The variable ATTRIBUTE_TAGS_MAP contains the list of valid attributes for each HTML element. The <dialog> entry does not currently include the closedby attribute.

Adding closedby to the list of allowed attributes for the dialog element in ATTRIBUTE_TAGS_MAP should resolve the issue and prevent false positives.

Details
CLI:
  Version:                      2.4.2
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           linux

Environment:
  BIOME_LOG_PATH:                    unset
  BIOME_LOG_PREFIX_NAME:             unset
  BIOME_LOG_LEVEL:                   unset
  BIOME_LOG_KIND:                    unset
  BIOME_CONFIG_PATH:                 unset
  BIOME_THREADS:                     unset
  BIOME_WATCHER_KIND:                unset
  BIOME_WATCHER_POLLING_INTERVAL:    unset
  NO_COLOR:                     unset
  TERM:                         xterm-256color
  JS_RUNTIME_VERSION:           v25.6.1
  JS_RUNTIME_NAME:              node
  NODE_PACKAGE_MANAGER:         unset

Biome Configuration:
  Status:                       Loaded successfully
  Path:                         biome.jsonc
  Formatter enabled:            true
  Linter enabled:               true
  Assist enabled:               true
  VCS enabled:                  false
  HTML full support enabled:    unset

Workspace:
  Open Documents:               0

Rule name

lint/nursery/noUnknownAttribute

Playground link

https://biomejs.dev/playground/?lineWidth=100&indentStyle=space&quoteStyle=single&lintRules=noUnknownAttribute&cssModules=true&code=PABkAGkAYQBsAG8AZwAgAG4AYQBtAGUAPQAiAHYAYQBsAGkAZAAiACAAYwBsAG8AcwBlAGQAYgB5AD0AIgBhAG4AeQAiACAAdQBuAGsAbgBvAHcAbgA9ACIAdAByAHUAZQAiAC8APgAKAA%3D%3D&ruleDomains.react=all&ruleDomains.project=all&ruleDomains.test=all&ruleDomains.solid=all&ruleDomains.next=all

Expected result

Do not warn when using closedby attribute on <dialog> element.

https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/dialog#closedby

Code of Conduct

  • I agree to follow Biome's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LinterArea: linterL-HTMLLanguage: HTML and super languagesL-JavaScriptLanguage: JavaScript and super languagesS-Bug-confirmedStatus: report has been confirmed as a valid bug

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions