bug #359961 attendee list has some usability issues, r=tbe

This commit is contained in:
michael.buettner%sun.com 2006-11-20 12:11:43 +00:00
Родитель fbcf8bf2bc
Коммит c8a893409a
1 изменённых файлов: 54 добавлений и 20 удалений

Просмотреть файл

@ -75,7 +75,7 @@
searchSessions="addrbook" timeout="300" maxrows="4" searchSessions="addrbook" timeout="300" maxrows="4"
autoFill="true" autoFillAfterMatch="true" forceComplete="true" autoFill="true" autoFillAfterMatch="true" forceComplete="true"
minResultsForPopup="1" ignoreBlurWhileSearching="true" minResultsForPopup="1" ignoreBlurWhileSearching="true"
ontextcommand="" ontextcommand="this.focus();"
onerrorcommand="" onerrorcommand=""
oninput="this.setAttribute('dirty','true');"> oninput="this.setAttribute('dirty','true');">
<xul:image class="person-icon" onclick="this.parentNode.select();"/> <xul:image class="person-icon" onclick="this.parentNode.select();"/>
@ -105,6 +105,7 @@
<field name="mOrganizerID">null</field> <field name="mOrganizerID">null</field>
<field name="mIsReadOnly">false</field> <field name="mIsReadOnly">false</field>
<field name="mIsOrganizer">false</field> <field name="mIsOrganizer">false</field>
<field name="mPopupOpen">false</field>
<constructor> <constructor>
<![CDATA[ <![CDATA[
@ -182,6 +183,7 @@
var listbox = document.getAnonymousElementByAttribute(this, "anonid", "listbox"); var listbox = document.getAnonymousElementByAttribute(this, "anonid", "listbox");
var template = document.getAnonymousElementByAttribute(this, "anonid", "item"); var template = document.getAnonymousElementByAttribute(this, "anonid", "item");
template.focus();
// we need to enfore several layout constraints which can't be modelled // we need to enfore several layout constraints which can't be modelled
// with plain xul and css, at least as far as i know. // with plain xul and css, at least as far as i know.
@ -246,6 +248,8 @@
self.onModify(); self.onModify();
} }
callback(); callback();
this.setFocus(this.mMaxAttendees);
]]> ]]>
</body> </body>
</method> </method>
@ -799,11 +803,11 @@
<parameter name="aRow"/> <parameter name="aRow"/>
<body> <body>
<![CDATA[ <![CDATA[
var listbox = document.getAnonymousElementByAttribute(this, "anonid", "listbox"); var self = this;
var node = this.getListItem(aRow); var set_focus = function func() {
// do we need to scroll in order to see the selected row? // do we need to scroll in order to see the selected row?
var listbox = document.getAnonymousElementByAttribute(this, "anonid", "listbox"); var node = self.getListItem(aRow);
var listbox = document.getAnonymousElementByAttribute(self, "anonid", "listbox");
var firstVisibleRow = listbox.getIndexOfFirstVisibleRow(); var firstVisibleRow = listbox.getIndexOfFirstVisibleRow();
var numOfVisibleRows = listbox.getNumberOfVisibleRows(); var numOfVisibleRows = listbox.getNumberOfVisibleRows();
if (aRow <= firstVisibleRow) if (aRow <= firstVisibleRow)
@ -814,6 +818,8 @@
var input = document.getAnonymousElementByAttribute(node, "anonid", "input"); var input = document.getAnonymousElementByAttribute(node, "anonid", "input");
input.focus(); input.focus();
}
setTimeout(set_focus,0);
]]> ]]>
</body> </body>
</method> </method>
@ -867,13 +873,16 @@
if(row > this.mMaxAttendees) { if(row > this.mMaxAttendees) {
this.appendNewRow(true); this.appendNewRow(true);
} else { } else {
var input = this.getInputElement(row);
if(input.hasAttribute("disabled"))
return;
this.setFocus(row); this.setFocus(row);
} }
}
var event = document.createEvent('Events'); var event = document.createEvent('Events');
event.initEvent('rowchange', true, false); event.initEvent('rowchange', true, false);
event.details = row; event.details = row;
this.dispatchEvent(event); this.dispatchEvent(event);
}
]]> ]]>
</body> </body>
</method> </method>
@ -1329,6 +1338,18 @@
]]> ]]>
</handler> </handler>
<handler event="popupshown">
<![CDATA[
this.mPopupOpen = true;
]]>
</handler>
<handler event="popuphidden">
<![CDATA[
this.mPopupOpen = false;
]]>
</handler>
<handler event="keydown"> <handler event="keydown">
<![CDATA[ <![CDATA[
if(this.mIsReadOnly || !this.mIsOrganizer) if(this.mIsReadOnly || !this.mIsOrganizer)
@ -1342,6 +1363,7 @@
event.stopPropagation(); event.stopPropagation();
break; break;
case 13: case 13:
this.arrowHit(event.originalTarget, 1);
event.stopPropagation(); event.stopPropagation();
event.preventDefault(); event.preventDefault();
break; break;
@ -1350,8 +1372,15 @@
]]> ]]>
</handler> </handler>
<handler event="keypress"> <handler event="keypress" phase="capturing">
<![CDATA[ <![CDATA[
// in case we're currently showing the autocompletion popup
// don't care about keypress-events and let them go. otherwise
// this event indicates the user wants to travel between
// the different attendees. in this case we set the focus
// appropriately and stop the event propagation.
if(this.mPopupOpen)
return;
if(this.mIsReadOnly || !this.mIsOrganizer) if(this.mIsReadOnly || !this.mIsOrganizer)
return; return;
if(event.originalTarget.localName == "input") { if(event.originalTarget.localName == "input") {
@ -1364,6 +1393,11 @@
this.arrowHit(event.originalTarget, 1); this.arrowHit(event.originalTarget, 1);
event.stopPropagation(); event.stopPropagation();
break; break;
case KeyEvent.DOM_VK_TAB:
this.arrowHit(event.originalTarget, event.shiftKey ? -1 : +1);
event.stopPropagation();
event.preventDefault();
break;
case KeyEvent.DOM_VK_RETURN: case KeyEvent.DOM_VK_RETURN:
event.stopPropagation(); event.stopPropagation();
event.preventDefault(); event.preventDefault();