Skip to content

Tab-sets cannot be nested in dropdowns in custom directives #232

Open
@keitaay

Description

@keitaay

Describe the bug

Context and Expectation
I'm trying to create a multi-language API document, and I want to nest together tabs, directives etc. to organize language-specific and language-agnostic information in concise ways. I found Sphinx-Design to be helpful in that - and wanted to automate the creation of new elements by replacing manually-defined nested directives with those that are automatically defined using custom directives. However, I ran into an issue where I can create just dropdown elements just fine, and just tab-sets/tab-items just fine. ...but I can't seem to create instances where a dropdown is the parent of a tab-set.

See my reply to issue 217 for relevant error messages. I isolated this behavior in this repo and commit, which consists of a single-page Sphinx Book Theme doc with two dropdowns:

  1. Expected behavior: A dropdown directive is manually defined, and a manually defined tab-set directive (which, in turn, contains two tab-item elements) is inside it.
  2. Actual behavior: A dropdown is automatically created, but all contents of the tab-set and tab-item directives just render as plain text inside the dropdown.

Screenshot showing expected and actual behaviors next to each other

Any suggestions on how to get started?

Reproduce the bug

  1. Create a local directive subclassed from SdDirective
  2. Create a Sphinx document with Sphinx-Design that calls the directive
  3. Populate the directive's "run" method with a constructor for multiple "tab-item" nodes
  4. Also add a constructor for a "tab-set" node to contain the "tab-item" nodes in the previous step
  5. Ditto, but for a "dropdown" node; you must convert the tab-set node into a string, or else Sphinx's build process fails?
  6. Build the document

Note that I made commit 97244c5 of this repo to recreate this issue in an isolated environment. Please feel free to clone and build it, as an alternative.

List your environment

  • Sphinx 8.1.3
  • MyST-Parser 4.0.0
  • Sphinx-Design 0.6.1
  • Sphinx Book Theme 1.1.3
  • PyData Sphinx Theme 0.15.4 (per this issue)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions