Problem/Motivation
When I was working on #2349577: "Edit" button on machine name doesn't disappear at first I discovered in core/misc/machine-name.js three occurrences of .append(' ') (append whitespace). Example:
$suffix.append(' ').append('<span class="machine-name-label">' + options.label + ':</span>');
Proposed resolution
Change .append(' ') to content: ' ['; in system.admin.css (patch #3).


Remaining tasks
Replace .append(' ') with CSS style in system.admin.css.
Review and commit.
User interface changes
API changes
Beta phase evaluation
| Issue category | Task |
|---|---|
| Prioritized changes | The main goal of this issue is simplification of Javascript to make code more maintainable |
| Comment | File | Size | Author |
|---|---|---|---|
| #37 | core-change-append-2360175-37.patch | 1.63 KB | nod_ |
| #3 | change_append-2360175-3.patch | 1.65 KB | droplet |
| #2 | 2360175-6.jpg | 77.48 KB | gaurav.goyal |
| #2 | 2360175-7.jpg | 174.76 KB | gaurav.goyal |
| #2 | 2360175-5.jpg | 183.2 KB | gaurav.goyal |
Comments
Comment #1
zaporylieI've attached initial patch to fix this issue, and some screens to summary. Also changed system.theme.css to system.admin.css which seems to be better place.
Comment #2
gaurav.goyal commentedUpon manual review patch looks good to me, Attached are the screen shots.
checked for the following
1. Different screen sizes
2. Different types of fields, taxonomies, content types.
#1 Works for for me
Comment #3
droplet commentedWhy not append the SPACE ?
Comment #4
zaporylieI believe this is also a good way to solve issue but you should definitely support RTL users in your CSS.
Comment #5
mcdruid commentedLooking at the change record for "Use [dir="rtl"] in stylesheets" https://www.drupal.org/node/2032405 it looks like the CSS has been written appropriately, with the very small exception of whitespace in the LTR comments.
New patch to address that very minor whitespace in the CSS comments issue.
Other than that, RTBC.
Comment #6
droplet commented#5 is diff to my one on #3. Back to Needs review for another reviewer.
My last testing on #3 Patch is working on RTL as well. Personally, I love my patch, more simpler :)
Thanks.
Comment #7
mcdruid commented@droplet it seems redundant to me to be moving the addition of whitespace characters from the JS to the CSS. If this is a layout issue, I'd have thought it better to do the layout via margins / box model rather than the addition of space characters to the HTML, regardless of the mechanism by which they're inserted between pieces of content.
However, it's been a while since I did much front-end.
Also, your #3 patch removed the space being appended before the preview:
...but this is not added back in by CSS. Instead you've added it to string after the closing span tag:
To me that reinforces the suggestion that your approach is just rearranging the way that whitespace characters are added between the text elements.
Therefore the original approach of removing the whitespace characters altogether and implementing the layout via "pure" CSS would get my vote.
Comment #8
jhedstromI think this is at needs work per #7. I've taken a stab at the beta phase evaluation in the issue summary.
Comment #9
jhedstromEr, wait, I got confused. This is still at needs review. I tend to agree that #5 makes sense, rather than adding more spaces in the JS as #3 does.
Comment #12
zaporylieComment #13
pushpinderchauhan commentedRerolled.
Comment #14
droplet commentederrors on machine name, please check: admin/structure/types/add
Comment #15
sivaji_ganesh_jojodae commented#13 looks fine to me. Patch applies cleanly and no errors on machine name at admin/structure/types/add.
Comment #16
droplet commented*** To remember clean caches after patching
Comment #17
sivaji_ganesh_jojodae commented@droplet, thank you.
Removing float seems to fix the issue. Patch attached.
Comment #18
droplet commentedalthough i like my own way, it's patch still looks good and no reason not let it go ahead :)
Comment #19
sivaji_ganesh_jojodae commentedThanks for the RTBC.
Regarding #3,
IMO the space before [ will certainly make someone wonder so I prefer not to go for it.
Comment #22
tadityar commentedIt's a re-roll, passed, and was RTBC-ed before, so re-up RTBC.
Comment #25
tadityar commentedPassed again, RTBC again.
Comment #26
alexpottI'm not that convinced by this issue. We're building text here that is meant to be read as a sentence - the space has a semantic meaning when placed between words.
I think the use of
.append(' ')is acceptable and denotes that it is intended - since it would be possible to add the space into the variables if we want.Tempted to mark "Closed - works as designed" but will punt back to needs review for further consensus building.
Comment #27
nod_I'm not comfortable with creating a space using margins (partly due to the fact that I'm not sure we can replicate exactly the size of the space character with margins).
I like the solution in #3 as well, the extra characters are added from there as well, makes sense to have the spacing done at the same place.
Comment #28
lewisnymanYeah the solution in #3 makes more sense to me. The space added in CSS should get picked up by screen readers.
Comment #30
lewisnymanThe patch in #3 still applies so knocking back to RTBC so Alex can weigh in.
Comment #31
zaporylieI made some changes in issue summary to show where we are with this issue.
Comment #32
brahmjeet789 commentedappend the .append(' ') for the core/misc/machine-name.js
Comment #33
lewisnymanSetting back to needs review then.
Comment #34
droplet commentedwhat is #32 trying to do ? uploaded a wrong patch ?
Comment #35
zaporylieI looks like mixed patch for this issue with some other, unrelated piece of code.
#3 is still the one which should be committed.
Comment #36
alexpottCan some one upload the patch in #3 again so the correct path is the most recent patch on the issue.
Comment #37
nod_Reup of #3 with one small change:
Before
After
Notice the space at the end is inside the span, which means that append will only add one DOM element, not two — a span and text element.
Comment #38
zaporylieI have no problem to apply patch #37 and it works as designed and looks great on most recent version of D8. I believe it's time to close this issue and commit last patch.
Comment #39
alexpottCSS and JS changes are not subject to beta evaluation and this change is not disruptive. Committed 58a891f and pushed to 8.0.x. Thanks!
Comment #42
brahmjeet789 commented