Skip to content

Regression: :kbd: in Sphinx 8.2 #13876

@brechtm

Description

@brechtm

Describe the bug

For this reStructuredText:

:kbd:`Control-x`

Sphinx < 8.2 produces these doctree elements (pseudoXML):

<literal classes="kbd">
    Control-x

Since Sphinx 8.2, the following is produced:

<literal classes="kbd">
    Control
-
<literal classes="kbd">
    x

The result is that the hyphen cannot be styled properly, as it is not indicated to be related to the keyboard shortcut. Perhaps the entire shortcut could be wrapped in an inline block with a particular class?

How to Reproduce

N/A

Environment Information

Platform:              darwin; (macOS-15.6.1-arm64-arm-64bit-Mach-O)
Python version:        3.13.7 (main, Aug 23 2025, 23:13:28) [Clang 17.0.0 (clang-1700.0.13.5)])
Python implementation: CPython
Sphinx version:        8.2.3
Docutils version:      0.20.1
Jinja2 version:        3.1.4
Pygments version:      2.18.0

Sphinx extensions

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions