New issue
Advanced search Search tips

Issue 872413 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner: ----
Closed: Aug 30
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 3
Type: Feature


Show other hotlists

Hotlists containing this issue:
Hotlist-1


Sign in to add a comment

Empty title attribute should not show UA-provided tooltips

Reported by bgros...@gmail.com, Aug 8

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.84 Safari/537.36

Steps to reproduce the problem:
1. Create a webpage with an HTML element, such as <input type="file">

2. Load in Chrome, open Developer console

3. Try to set a new attribute on input to an empty string, such as: document.getElementsByTagName('input')[0].setAttribute("title","")

What is the expected behavior?
After running setAttribute(), the HTML should contain an attribute that looks like: title="", such that the new markup is:

<input type="file" title="">

What went wrong?
The empty string is ignored, and the markup produced is instead the following:

<input type="file" title>

In other words, it drops off the =""

Did this work before? N/A 

Chrome version: 68.0.3440.84  Channel: n/a
OS Version: OS X 10.13.6
Flash Version: Shockwave Flash 30.0 r0

This works as expected in Firefox.
 
The specification doesn't say ="" is required so there's no bug in Chrome.
https://www.w3.org/TR/html/syntax.html#elements-attributes

    Empty attribute syntax
    Just the attribute name. The value is implicitly the empty string.


Ok. Perhaps I need to move this to a feature request?

There are times when Chrome interprets title vs title="" differently. The <input type="file"> tag is a good example. If it has title, then Chrome creates its own tooltip for the element. If it has title="", then Chrome uses the empty string as the tooltip.
Following up, the spec says:

Empty attribute syntax --
Just the attribute name. The value is implicitly the empty string.

But in this case, Chrome is interpreting title differently than title="". This suggests the implicit value of title is not the same in both cases.
Since 'title' and 'title=""' are same as per HTML specification, it might make sense to submit a new bug report on Chrome's different handling of the tooltip, but that's for Chromium engineers to decide. BTW I don't see any difference in Windows - the standard tooltip is displayed in both cases as it should.
Thank you, that makes sense as a next step.

And I now see I presumed my problem was the missing ="", but on the Mac I'm getting same behavior as you on Windows. Here's what I see:

<input type="file"> ... produces a tooltip of "No file chosen"
<input type="file" title> ... produces a tooltip of "No file chosen"
<input type="file" title=""> ... produces a tooltip of "No file chosen"
<input type="file" title="something"> ... produces a tooltip of "something"

Given that title="something" produces a tooltip of "something" I would expect title="" to produce a tooltip of "", while an absent title attribute would lead Chrome to produce its own "No file chosen". 

I will file a new report re the tooltip handling--would this appropriately be a bug report or feature request? I'm guessing the latter.
Labels: Needs-Triage-M68
Labels: -Type-Bug Triaged-ET Target-70 M-70 FoundIn-70 Type-Feature
Status: Untriaged (was: Unconfirmed)
As per comment #2 and #5, it seems to be a feature request. Hence, marking it as untriaged for further inputs from dev team.

Thanks...!!
Components: -Blink UI UI>Browser
I'm pretty sure this is not Blink specific. The decision to what to show on tooltip is UI/Browser. Reassigning.
Components: -UI -UI>Browser Blink
The default tooltip appears to be controlled here in blink:
https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/html/forms/file_input_type.cc?rcl=e6a59a6bf0c44a45fabe15389cd29373325eb4e8&l=413

kFileButtonNoFileSelectedLabel -> IDS_FORM_FILE_NO_FILE_LABEL -> "No file chosen"
Components: -Blink Blink>Forms
Components: Blink>HTML
Labels: -Pri-2 -Target-70 -M-70 -Needs-Triage-M68 Hotlist-GoodFirstBug Pri-3
Status: Available (was: Untriaged)
Summary: Empty title attribute should not show UA-provided tooltips (was: setAttribute cannot set an attribute's value to an empty string)
The request sounds reasonable.
The code is in blink::ChromeClient::SetToolTip().

Can I take a look at this issue?
donghee.na92@, please go ahead.

Project Member

Comment 15 by bugdroid1@chromium.org, Aug 30

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/6006113385396ec9d24faf9284756ea32cefd907

commit 6006113385396ec9d24faf9284756ea32cefd907
Author: Dong-hee Na <donghee.na92@gmail.com>
Date: Thu Aug 30 08:34:53 2018

HTML: Fix tooltips with an empty title attribute

Before this CL, the tooltip for an empty title attribute showed an
element-specific default tooltip message like "No file chosen" for
<input type=file>. But now it does not show any tooltip since the tooltip
message is considered as "".

The new behavior matches to Mozilla Firefox.

Bug:  872413 
Change-Id: I120a2bb7f9a6d244ceca660b79f9033e3a75af9e
Reviewed-on: https://chromium-review.googlesource.com/1186930
Reviewed-by: Kent Tamura <tkent@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#587483}
[modify] https://crrev.com/6006113385396ec9d24faf9284756ea32cefd907/content/test/test_blink_web_unit_test_support.cc
[modify] https://crrev.com/6006113385396ec9d24faf9284756ea32cefd907/third_party/blink/renderer/core/page/chrome_client.cc
[modify] https://crrev.com/6006113385396ec9d24faf9284756ea32cefd907/third_party/blink/renderer/core/page/chrome_client.h
[modify] https://crrev.com/6006113385396ec9d24faf9284756ea32cefd907/third_party/blink/renderer/core/page/chrome_client_test.cc

Labels: Target-70
Status: Fixed (was: Available)

Sign in to add a comment