Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect placement of internal links in typed method signatures #183

Closed
jakelishman opened this issue Feb 16, 2023 · 2 comments · Fixed by #319
Closed

Incorrect placement of internal links in typed method signatures #183

jakelishman opened this issue Feb 16, 2023 · 2 comments · Fixed by #319
Assignees
Labels
bug Something isn't working
Milestone

Comments

@jakelishman
Copy link
Member

jakelishman commented Feb 16, 2023

Most of the time, the docs build procedure uses sphinx-autodoc-typehints to move typehints from function signatures into the docstring (as far as Sphinx sees). However, in some cases that's not entirely possible, for example when a function or method uses typing.overload to specify two separate calling conventions. In these cases, the type information is still in the function signature (which is probably a good thing - it's clearer when there's two separate ones), but the Sphinx theme mistreats the internal links; they match the same CSS rules for position: absolute that the little [source] link does.

For example, on the page for qiskit.circuit.QuantumCircuit.if_test:

Screenshot 2023-02-16 at 10 53 20

I'm not sure how long this has been the case.

@jakelishman jakelishman added the bug Something isn't working label Feb 16, 2023
@Eric-Arellano Eric-Arellano added this to the Theme v12.0.0 milestone Apr 3, 2023
@Eric-Arellano Eric-Arellano self-assigned this Apr 11, 2023
@Eric-Arellano
Copy link
Collaborator

This is still a bug as of 1.11, even after migrating away from sphinx-autodoc-typehints in Qiskit/qiskit-metapackage#1716:

Screenshot 2023-04-11 at 9 56 53 AM

@jakelishman
Copy link
Member Author

Yeah, it's not a problem of sphinx-autodoc-typehints specifically, I think it's that CSS rule that's applying a position: absolute a little too excitedly.

Eric-Arellano pushed a commit that referenced this issue May 11, 2023
fixes #183 
fixes #21 

I tested this as best I could running locally and validating the changes
I made with the inspect tool in production. However I can't be 100% sure
as our local build doesn't currently have methods that a) use the
`typing.overload` decorator and b) use internal links in their
arguments.

testing in the browser using the inspect tools on live
https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.if_test.html#qiskit.circuit.QuantumCircuit.if_test
<img width="1142" alt="Screenshot 2023-05-11 at 2 34 41 PM"
src="https://github.com/Qiskit/qiskit_sphinx_theme/assets/23662430/fbee8a50-c081-4a1f-a68f-484c7eff7b63">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants