While using the overlay window, the document title remains the same. This is quite bothersome if you use multiple windows while administrating the website. For instance:
- Browse to your homepage after a clean install.
- The document title (and thus the browser window title) reads Welcome to [Site name].
- Open the admin section (overlay opens) but the document title remains the same.
- Open some more admin sections in new windows or new tabs. All the windows have the same title, even if one overlays shows the Modules page and the other shows the Content page.
Currently, the page title is already added to the iframe title (for usability). IMHO this should be added to the document title as well.
See the screenshot to see what the patch does.
Comment | File | Size | Author |
---|---|---|---|
#24 | overlay-doctitle.patch | 1.31 KB | casey |
#23 | overlay_document_title6.patch | 1.63 KB | tstoeckler |
#21 | overlay_document_title5.patch | 1.64 KB | tstoeckler |
#18 | overlay_document_title4.patch | 1.69 KB | tstoeckler |
#17 | overlay-title-with-html.jpg | 61.85 KB | Georg |
Comments
Comment #1
BarisW CreditAttribution: BarisW commentedForgot to set the status :)
Comment #2
Kiphaas7 CreditAttribution: Kiphaas7 commentedGood idea, and needs to be fixed!
Lots of whitespaces on your newlines, those need to be removed. Also, in the code, the iframe title attribute is set, which you are retrieving in your patch. That's a DOM manipulation, and those are costly (even though it is performed on a cached object). It would be better to save the
Drupal.t('@title dialog', { '@title': iframeTitle })
in a separate variable, and use it for both setting the iframe attr title, and the document title.document.title = self.$iframe.attr('title') + ' | ' + self.$originalTitle;
Both the iframe title and the original title? Isn't the iframe title the title of the loaded page? So isn't this somehow duplicating parts and creating an unnecessarily long title? Or is the iframe title something else...
Also, you aren't setting the title back when the overlay gets closed....
Comment #3
BarisW CreditAttribution: BarisW commentedThanks for your thorough review!
Attached is a new patch where I altered your suggestions:
- I save the title in a separate variable
- The document title now equals the iframe title, so I don't attach the original title anymore
- The original title gets restored when the overlay is closed.
Let me know what you think!
Comment #4
BarisW CreditAttribution: BarisW commentedForgot to add the patch :)
Comment #5
Georg CreditAttribution: Georg commentedSuccessfully tested patch from #4 on:
IE8
Firefox 3.6.3
Safari 4.0.5
Opera 10.10
IE6
Chrome 4.1.249.1045 (42898)
It even works after translating it into German. ^^
Comment #6
Kiphaas7 CreditAttribution: Kiphaas7 commentedNice to have a test report! I think that there are still some rogue spaces on your newlines in the patch :). Other than that, it looks good. Again, haven't tried it because my dev pc is still broken.
Comment #7
BarisW CreditAttribution: BarisW commentedSo, what makes this a RBTC? And can we still get this in D7?
Comment #8
Kiphaas7 CreditAttribution: Kiphaas7 commentedIf at least 1 other person tests it, and then sets it RTBC.....
Comment #9
jpmckinney CreditAttribution: jpmckinney commentedCode looks good, and #5 confirms it works in popular browsers.
Comment #10
BarisW CreditAttribution: BarisW commentedHmm, I just found out that the HTML code needs to be stripped out first.
This is more like a new bug that that is has something do do with this issue.
However, it would be small enough to keep it into this commit I guess.
The problem arises when the page title uses HTML tags.
We need to strip out the HTML tags from the iFrameTitle.
var iframeTitle = self.$iframeDocument.attr('title');
See the attachment.
Comment #11
BarisW CreditAttribution: BarisW commentedMy previous screenshot isn't really clear. I'll add another one.
The article is called 'Test', see this attachment.
Comment #12
jpmckinney CreditAttribution: jpmckinney commentedBarisW, I don't understand what bug you're talking about.
We should not strip HTML tags from the iframe title. Sometimes we want that.
Comment #13
jpmckinney CreditAttribution: jpmckinney commentedPlease don't CNW an RBTC patch if what you think "needs work" is something you consider to be a new bug that deserves its own issue.
Comment #14
BarisW CreditAttribution: BarisW commentedOk, apologies. I agree with you, I will start another issue for this bug.
Let's get this one in first :)
Comment #15
David_Rothstein CreditAttribution: David_Rothstein commentedCool patch, but do we really want to put the word "dialog" in every page title like that? That seems like jargon to me. Instead of "Structure dialog", "Content dialog", etc, don't we rather want "Structure | My Site", "Content | My Site", etc (i.e., the same title they would see without the overlay)? I think it's somewhat important to keep the name of the site in there...
For the issue of HTML in the iframe title, see #725734: Overlay doesn't escape any page titles (residual cleanup) where that is being handled. That might help here as well, since it provides a mechanism to pass data about the title from the child window to the parent window's JS.
Comment #16
BarisW CreditAttribution: BarisW commentedGuys,
a new patch. It now only sets the document title the same as the page title.
So instead of 'Modules dialog' it's just plain 'Modules'.
Let's get this puppy committed, as it really is a big usability improvement.
Comment #17
Georg CreditAttribution: Georg commentedlooks simple enough.
The only thing that bothers me now: html is displayed in the title. Would it be possible, to not display html? If there is no way to do this, I'd RTBC this.
Comment #18
tstoecklerWithout whitespace and adds the missing periods at the end of comments.
I stripped the HTML using a regex stolen from Drupal.ajaxError in drupal.js.
I have no clue whether the regex is too permissive or insecure or whatever, but testing the page in #17 now displays the title correctly.
Comment #19
tstoecklerI just noticed that regarding the page title, there is already an issue for that, or at least a related issue. I'll let someone who has spent more than 15 minutes in overlay's code decide whether to fix it here or there or whatever.
#725734: Overlay doesn't escape any page titles (residual cleanup)
Comment #20
casey CreditAttribution: casey commentedA document with a <title> containing html elements is invalid. So it shouldn't be fixed here.
Comment #21
tstoecklerAll right. This is #16 without whitespace and with periods.
Comment #22
casey CreditAttribution: casey commentedI think you should change $originalTitle to originalTitle (we use $variable for jquery objects).
$(document).attr('title') should be document.title; The title element is no attribute of document (which isnt even an element). Besides, document.title is totally crossbrowser.
I know $(document).attr('title') is currently also used for var iframeTitle, but I changed that in #668640: Overlay shouldn't be based on jQuery UI Dialog.
Comment #23
tstoecklerIncorporates #22.
Untested.
Comment #24
casey CreditAttribution: casey commentedThings need to be done a little different as #668640: Overlay shouldn't be based on jQuery UI Dialog landed.
Comment #25
David_Rothstein CreditAttribution: David_Rothstein commentedThis still has the problem that it puts HTML in the page title, and (as per #15) doesn't use the full Drupal page title (missing the "... | My Site Name" part).
However, when combined with the latest patch at #725734: Overlay doesn't escape any page titles (residual cleanup) it seems to work perfectly, so we might be good to go here as long as both of them get in :)
Comment #26
casey CreditAttribution: casey commentedRTBC?
Comment #27
aspilicious CreditAttribution: aspilicious commented#725734: Overlay doesn't escape any page titles (residual cleanup) is in, so this one is rtbc by david (#25)
Comment #28
David_Rothstein CreditAttribution: David_Rothstein commentedYup, agreed with RTBC. The code looks good and it now works perfectly!
Comment #29
BarisW CreditAttribution: BarisW commentedAgree, looks good. Thanks for the help ;)
Comment #30
casey CreditAttribution: casey commentedStill applies.
Comment #31
BarisW CreditAttribution: BarisW commentedAnd still appplies. Get this puppy committed please :)
Comment #32
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks.