Problem/Motivation
The documentation for the Drupal.theme.dropbuttonToggle
function doesn't make sense. It says:
* @param {string} [options.title]
* The HTML anchor title attribute and text for the inner span element.
But this theme function doesn't output a HTML anchor - it outputs a HTML button. And there isn't a title attribute in the output either.
Proposed resolution
Update the docblock, so it matches the actual output:
options.title
is the label for a HTML button (not for a HTML anchor).- and remove the part about the title attribute, because there isn't a title attribute in the output.
Remaining tasks
- Patch the docblock in
core/misc/dropbutton.es6.js
- Note: the changes in the ES6 file are comments only, which are stripped out when transpiled. So we're not expecting a change in the ES5 JS file.
Recompilecore/misc/dropbutton.js
(see javascript workflow instructions).
User interface changes
None.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#17 | docblock-for-dropbutton-2972445-17.patch | 524 bytes | sudheeshps |
#11 | docblock-for-dropbutton-2972445-9.patch | 530 bytes | sudheeshps |
#8 | docblock-for-dropbutton-2972445-8.patch | 558 bytes | sudheeshps |
#4 | 2972445-4.patch | 557 bytes | Anonymous (not verified) |
Comments
Comment #2
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer commentedThis is an easy documentation issue for the Manchester sprint. Also a good opportunity to learn about how we manage the ES6 and compiled JS files in drupal core.
Comment #3
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer commentedComment #4
Anonymous (not verified) CreditAttribution: Anonymous as a volunteer commentedHi @andrewmacpherson,
I've added a patch for the docblock change in the es6 file. Unfortunately, when I run
yarn run build:js
there doesn't seem to be any changes made todropbutton.js
. Am I missing anything?Comment #5
Anonymous (not verified) CreditAttribution: Anonymous as a volunteer commentedComment #6
GrandmaGlassesRopeMan@sjhuda Comments are removed in the transpile process.
Comment #7
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer commented@sjhuda -
I've added a patch for the docblock change in the es6 file. Unfortunately, when I run yarn run build:js there doesn't seem to be any changes made to dropbutton.js. Am I missing anything?
Ah, the changes are solely in the documentation comments of the ES6 file, and the comments are stripped out when transpiling the JS file. So this is fine - we're not expecting a change in the compiled JS file.
I think we can go a bit further and just say "The HTML button label." There's nothing special about the internal span structure, as far as this comment goes. Can you roll another patch?
Comment #8
sudheeshps CreditAttribution: sudheeshps at TATA Consultancy Services commented@andrewmacpherson,
Changed comment as mentioned. Please check and let me know
Comment #9
sudheeshps CreditAttribution: sudheeshps at TATA Consultancy Services commentedComment #11
sudheeshps CreditAttribution: sudheeshps at TATA Consultancy Services for Johnson & Johnson commentedUpdated patch
Comment #12
sudheeshps CreditAttribution: sudheeshps at TATA Consultancy Services commentedComment #13
mahalingam_cs CreditAttribution: mahalingam_cs at TATA Consultancy Services commentedComment #14
mahalingam_cs CreditAttribution: mahalingam_cs at TATA Consultancy Services for Johnson & Johnson commentedApplied patch from #11 and was successful.
"The HTML anchor....." is updated to "The HTML button label."
Comment #15
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer commentedThanks, patch #11 looks great.
Comment #16
alexpottI think rather than using label which has quite a few meanings in HTML let's go for
The button text.
- I think HTML is redundant here - this is a theme function after all.
The wording button text comes from https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button
Comment #17
sudheeshps CreditAttribution: sudheeshps at TATA Consultancy Services for Johnson & Johnson commentedThanks @alexpott, I have updated the text again.
Comment #18
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer commentedPerfect, patch #17 address #16 exactly.
Comment #19
mahalingam_cs CreditAttribution: mahalingam_cs at TATA Consultancy Services for Johnson & Johnson commented+1 RTBC. Patch #17 applied cleanly and fixed the comments 16
Comment #20
alexpottCredited @andrewmacpherson and myself for comments that affected the patch.
Comment #21
alexpottCommitted and pushed 346860aff3 to 8.6.x and 5f531759ef to 8.5.x. Thanks!