Skip to content

Missing type="button" attribute in NavigationItem.hbs template #267

@pekkah

Description

@pekkah

Description

The generated ui-bundle/partials/NavigationItem.hbs template contains a button element without an explicit type attribute, which could lead to unexpected form submission behavior.

Current Behavior

The button in NavigationItem.hbs is missing the type attribute:

<button class="btn btn-sm btn-link p-0" data-bs-toggle="collapse" data-bs-target="#nav-{{DisplayLink.Link.Xref.Path}}" aria-expanded="false" aria-controls="nav-{{DisplayLink.Link.Xref.Path}}" aria-label="Toggle submenu">

Expected Behavior

Buttons should explicitly declare their type to prevent unexpected form submissions:

<button class="btn btn-sm btn-link p-0" type="button" data-bs-toggle="collapse" data-bs-target="#nav-{{DisplayLink.Link.Xref.Path}}" aria-expanded="false" aria-controls="nav-{{DisplayLink.Link.Xref.Path}}" aria-label="Toggle submenu">

Impact

Without an explicit type attribute, buttons default to type="submit" which could cause unexpected form submissions if the button is placed within a form element. While this particular button is used for navigation toggling and unlikely to be in a form, it's a best practice to always specify the button type.

Solution

Add type="button" to all button elements that are not intended for form submission.

Found In

This issue was discovered during a code review by Gemini Code Assist on chibi-ui-2 PR #88.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions