Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 796365 - Treat contenteditable as a special text field to bring u…
Browse files Browse the repository at this point in the history
…p the keyboard. r=vingtetun a=blocking-basecamp
  • Loading branch information
Yuan Xulei committed Nov 12, 2012
1 parent 5802fe3 commit fc65886
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions b2g/chrome/content/forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@ let FormAssistant = {
},

isFocusableElement: function fa_isFocusableElement(element) {
if (element.contentEditable && element.contentEditable == "true") {
return true;
}

if (element instanceof HTMLSelectElement ||
element instanceof HTMLTextAreaElement)
return true;
Expand All @@ -273,7 +277,8 @@ let FormAssistant = {

isTextInputElement: function fa_isTextInputElement(element) {
return element instanceof HTMLInputElement ||
element instanceof HTMLTextAreaElement;
element instanceof HTMLTextAreaElement ||
(element.contentEditable && element.contentEditable == "true");
},

tryShowIme: function(element) {
Expand All @@ -294,6 +299,13 @@ FormAssistant.init();

function getJSON(element) {
let type = element.type || "";
let value = element.value || ""

// Treat contenteditble element as a special text field
if (element.contentEditable && element.contentEditable == "true") {
type = "text";
value = element.textContent;
}

// Until the input type=date/datetime/time have been implemented
// let's return their real type even if the platform returns 'text'
Expand Down Expand Up @@ -329,7 +341,7 @@ function getJSON(element) {
return {
"type": type.toLowerCase(),
"choices": getListForElement(element),
"value": element.value,
"value": value,
"inputmode": inputmode,
"selectionStart": element.selectionStart,
"selectionEnd": element.selectionEnd
Expand Down

0 comments on commit fc65886

Please sign in to comment.