Restore support for dropdown tooltips
This commit is contained in:
parent
d66c64b9d7
commit
b82d4a65fe
@ -153,15 +153,28 @@ function processTooltipCheckNodes() {
|
|||||||
|
|
||||||
onUiUpdate(function(mutationRecords) {
|
onUiUpdate(function(mutationRecords) {
|
||||||
for (const record of mutationRecords) {
|
for (const record of mutationRecords) {
|
||||||
|
if (record.type === "childList" && record.target.classList.contains("options")) {
|
||||||
|
// This smells like a Gradio dropdown menu having changed,
|
||||||
|
// so let's enqueue an update for the input element that shows the current value.
|
||||||
|
let wrap = record.target.parentNode;
|
||||||
|
let input = wrap?.querySelector("input");
|
||||||
|
if (input) {
|
||||||
|
input.title = ""; // So we'll even have a chance to update it.
|
||||||
|
tooltipCheckNodes.add(input);
|
||||||
|
}
|
||||||
|
}
|
||||||
for (const node of record.addedNodes) {
|
for (const node of record.addedNodes) {
|
||||||
if (node.nodeType === Node.ELEMENT_NODE && !node.classList.contains("hide")) {
|
if (node.nodeType === Node.ELEMENT_NODE && !node.classList.contains("hide")) {
|
||||||
|
if (!node.title) {
|
||||||
if (
|
if (
|
||||||
node.tagName === "SPAN" ||
|
node.tagName === "SPAN" ||
|
||||||
node.tagName === "BUTTON" ||
|
node.tagName === "BUTTON" ||
|
||||||
node.tagName === "P"
|
node.tagName === "P" ||
|
||||||
|
node.tagName === "INPUT"
|
||||||
) {
|
) {
|
||||||
tooltipCheckNodes.add(node);
|
tooltipCheckNodes.add(node);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
node.querySelectorAll('span, button, p').forEach(n => tooltipCheckNodes.add(n));
|
node.querySelectorAll('span, button, p').forEach(n => tooltipCheckNodes.add(n));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user