#8925 closed bug (fixed)
Tooltip: Changes to title attribute while tooltip is open get reverted on close
Reported by: | jzelos | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 1.11.0 |
Component: | ui.tooltip | Version: | 1.9.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
When a tooltip is displayed on screen any changes to the title attribute of the element are ignored. This is apparent in Firefire 17 and Chrome 23.
See http://jsfiddle.net/wvRhb/ for a small proof.
Change History (13)
comment:1 Changed 10 years ago by
Resolution: | → notabug |
---|---|
Status: | new → closed |
comment:2 Changed 10 years ago by
Ah, ok, I assumed it would handle changes to the title attribute, my mistake.
One thing that remains a concern, is that it overwrites any change made to the title attribute when closing. I've updated the original fiddle to demonstrate, change the value with the tooltip on screen then click out of the input to see the value change from title1 to title2 and then back to title1 when the tooltip closes.
comment:3 Changed 10 years ago by
Sorry, didn't realise jsfiddle did change tracking, use http://jsfiddle.net/wvRhb/4/.
comment:5 Changed 10 years ago by
The title/tooltip initally shows an explanation of what should go in the field. I'm then reusing the tooltip to display an error message from a validation function then restoring the original title when the error is resolved.
comment:7 Changed 10 years ago by
Milestone: | 1.10.0 |
---|---|
Resolution: | notabug |
Status: | closed → reopened |
Summary: | Cannot change title when tooltip is open → Tooltip: Changes to title attribute while tooltip is open get reverted on close |
Re-opening to investigate whether we handle this. When restoring any title, we can check if the element already has a title. If it does, then it's a newly set value and we should leave it alone.
This won't cause the tooltip to change while open (which is why this was closed in the first place), but it would prevent "disappearing" values.
comment:8 Changed 10 years ago by
Status: | reopened → open |
---|
comment:10 Changed 9 years ago by
Re-opening to investigate whether we handle this. When restoring any title, we can check if the element already has a title. If it does, then it's a newly set value and we should leave it alone.
This won't cause the tooltip to change while open (which is why this was closed in the first place), but it would prevent "disappearing" values.
I submitted a pull request that will attempt to preserve changes to the title attribute made between the tooltip open and close.
https://github.com/jquery/jquery-ui/pull/1146
comment:11 Changed 9 years ago by
comment:12 Changed 9 years ago by
Resolution: | → fixed |
---|---|
Status: | open → closed |
Tooltip: On close and destroy only set title if empty or undefined
Ticket #8925 states that changes to the title attribute while the tooltip is open are lost on tooltip close.
In the close and destroy functions, the title attribute is always written if a value was stored in the element on open. It is possible the attribute has changed and restoring the initial value may overwrite the current value.
If the value is empty or undefined as set in open, do not set the title attribute.
This fix has the limitation that if the user removed the title attribute or set the value to an empty string the original title value would be restored on close and destroy.
Fixes #8925
Changeset: af85dfcafb32b7503392ca834eaa9d3162d54b28
comment:13 Changed 9 years ago by
Milestone: | → 1.11.0 |
---|
You need to use the content option - http://jsfiddle.net/tj_vantoll/9cV3n/.