Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#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 5 years ago by tj.vantoll

Resolution: notabug
Status: newclosed

comment:2 Changed 5 years ago by jzelos

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 5 years ago by jzelos

Sorry, didn't realise jsfiddle did change tracking, use http://jsfiddle.net/wvRhb/4/.

comment:4 Changed 5 years ago by Scott González

Why are you doing this?

comment:5 Changed 5 years ago by jzelos

The title/tooltip initally shows an explanation of what should go in a form field. I'm then reusing the tooltip to display an error message from a validation function before restoring the original title when the error is resolved.

Last edited 5 years ago by jzelos (previous) (diff)

comment:6 Changed 5 years ago by Scott González

#9181 is a duplicate of this ticket.

comment:7 Changed 5 years ago by Scott González

Milestone: 1.10.0
Resolution: notabug
Status: closedreopened
Summary: Cannot change title when tooltip is openTooltip: 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 5 years ago by Scott González

Status: reopenedopen

comment:9 Changed 4 years ago by Scott González

#9595 is a duplicate of this ticket.

comment:10 Changed 4 years ago by robotdan

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

Last edited 4 years ago by robotdan (previous) (diff)

comment:12 Changed 4 years ago by Daniel DeGroff

Resolution: fixed
Status: openclosed

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 4 years ago by Jörn Zaefferer

Milestone: 1.11.0
Note: See TracTickets for help on using tickets.