pydata-sphinx-theme icon indicating copy to clipboard operation
pydata-sphinx-theme copied to clipboard

ENH: Double click on function parameter selects parameter type as well

Open rok opened this issue 3 years ago • 5 comments

When I want to copy a name of a function parameter I typically double-click it to select. Normally that would select the entire parameter and I can now copy and paste it elsewhere. Here however there seems to be a css or js setting that causes the double click to select the parameter type as well. When I copy it the name of parameter is concatenated to type string without space in between. E.g. double clicking and copy-pasting parameter data from here will result in a string datastructured. Ideally it would result only in data.

Tested on Chrome 89 and Firefox 87, Ubuntu 20.04.

After re-reading this I realize it sounds horribly nitpicky and I apologize. I only bring it up because it might be a common ergonomic issue. Disregard if this makes no sense.

rok avatar Apr 15 '21 11:04 rok

I confirm this behavior (both desktop double-click and on mobile with long-press), and would personally consider it bug-ish.

drammock avatar Apr 15 '21 15:04 drammock

I tried to have a look at this one and I cannot explain what's happening.

if you look in the instector to what's happening you have the following html:

<dt>
    <strong>data</strong>
    <span class="classifier">structured ndarray, sequence of tuples or dicts, or DataFrame</span>
</dt>

the ":" is added with css using:

.classifier:before {
font-style: normal;
margin: 0 0.5em;
content: ":";
display: inline-block;
}

So I completely disabled the ":" and this is what I get: Capture d’écran 2022-06-11 à 17 30 00

which explains why they are both selected together. The question now is why are this 2 element not living in the same tag so close.

I tried to reproduce it in a codepen and it doesn't behave the same.

12rambau avatar Jun 11 '22 15:06 12rambau

I dared to ask on SO and I get an answer (https://stackoverflow.com/questions/73518486/cannot-select-tag-individually-when-double-click), It is effectively a bug, a bug as simple to solve as "add a space between strong and span.

this HTML is autogenerated, what is the extension you are using ? so that I can send a message to the appropriate repository

12rambau avatar Aug 29 '22 05:08 12rambau

Thanks for looking into this @12rambau!

By extension you mean Sphinx extension? I'm not really familiar with Pandas docs, but I suppose you can check here. I am seeing similar behaviour in Arrow docs, e.g. here.

rok avatar Aug 29 '22 10:08 rok

perfect my guess is that it's coming from numpydoc

12rambau avatar Aug 29 '22 12:08 12rambau