elements icon indicating copy to clipboard operation
elements copied to clipboard

Incorrect Anchor Links for Section Navigation in Stoplight Elements

Open sohitkumar opened this issue 11 months ago • 0 comments

Description: In my project, when rendering an API documentation page using the Stoplight Element component, I encounter an issue when clicking on the section links (e.g., "Request", "Response", "Body"). The anchor link displayed on hover is incorrect.

Steps to Reproduce:

  1. Render an API documentation page with sections like Request, Response, and Body using Stoplight Elements.
  2. Click on any section link like "Request" or "Response".
  3. Notice that when hovering over "Request", the URL changes to http://localhost:4206/#Request, instead of the expected URL structure: http://localhost:4206/documentation/platform/http-apis/operations/get-todos#Request.
  4. This is in contrast to the working behavior on the Stoplight Elements demo project (https://elements-demo.stoplight.io/operations/get-todos#Request), where the section link navigation works as expected.

Expected Behavior: The section links should generate the correct anchor URL, similar to the behavior observed in the demo project: http://localhost:4206/documentation/platform/http-apis/operations/get-todos#Request.

Actual Behavior: Currently, the anchor links are incorrect, resulting in URLs like http://localhost:4206/#Request.

"paths": { "/a/appx/todos": { "get": { "summary": "List Todos", "responses": { "200": { "description": "Returns a list of Todos", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Todos" } }, "examples": { "List of Todos": { "$ref": "#/components/examples/multiple-todos" } } } } }, "403": { "$ref": "#/components/responses/Unauthorized" }, "404": { "$ref": "#/components/responses/NotFound" } }, "operationId": "get-todos", "description": "Returns a list of todos\n\n*Markdown is supported in descriptions. Add information here for users to get accustomed to endpoints*", "parameters": [ { "$ref": "#/components/parameters/limit" } ], "security": [] } } }

Image

Image

sohitkumar avatar Jan 30 '25 11:01 sohitkumar