From 7cdaaa1c20fbf4d5d50c823d444d7a88459ab9e9 Mon Sep 17 00:00:00 2001 From: "sgehani%netscape.com" Date: Wed, 17 May 2006 02:32:34 +0000 Subject: [PATCH] Fix language navigation up/down button edge cases. b=120382; r=law; sr=hewitt --- suite/common/pref/pref-languages.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/suite/common/pref/pref-languages.js b/suite/common/pref/pref-languages.js index c8aecf35720..9bc792945d3 100644 --- a/suite/common/pref/pref-languages.js +++ b/suite/common/pref/pref-languages.js @@ -522,6 +522,20 @@ function MoveUp() { active_languages.ensureElementIsVisible(selected); } } + + if (active_languages.selectedIndex == 0) + { + // selected item is first + var moveUp = document.getElementById("up"); + moveUp.disabled = true; + } + + if (active_languages_treeroot.childNodes.length > 1) + { + // more than one item so we can move selected item back down + var moveDown = document.getElementById("down"); + moveDown.disabled = false; + } UpdateSavePrefString(); @@ -543,6 +557,21 @@ function MoveDown() { } } + if (active_languages.selectedIndex == + (active_languages_treeroot.childNodes.length - 1)) + { + // selected item is last + var moveDown = document.getElementById("down"); + moveDown.disabled = true; + } + + if (active_languages_treeroot.childNodes.length > 1) + { + // more than one item so we can move selected item back up + var moveUp = document.getElementById("up"); + moveUp.disabled = false; + } + UpdateSavePrefString(); } //MoveDown