Bug 168120

Summary: REGRESSION(r188138): Web Inspector: cannot edit next/previous DOM attribute by using tab/shift-tab
Product: WebKit Reporter: BJ Burg <bburg>
Component: Web InspectorAssignee: Matt Baker <mattbaker>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, hi, inspector-bugzilla-changes, mattbaker, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch none

Description BJ Burg 2017-02-10 09:42:21 PST
This is definitely a regression. It used to be possible to tab through attributes, which would cancel the current edit and start editing the next attribute.

Steps to reproduce:

1. Inspect an element with >1 attribute in Elements Tab
2. Press 'Enter' to start editing the first attribute
3. Press 'Tab' to cancel editing of first attribute and start editing next attribute
=> DOMTreeOutline loses selection, sometimes the Quick Console gets caret/focus
Comment 1 Radar WebKit Bug Importer 2017-02-10 09:42:42 PST
<rdar://problem/30466065>
Comment 2 Matt Baker 2017-02-11 01:50:00 PST
Regressed way back in https://trac.webkit.org/changeset/188138.

Tabbing to the next attribute *does* work, as long as the current attribute text changes:

--- a/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js
+++ b/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js
@@ -874,6 +875,9 @@ WebInspector.DOMTreeElement = class DOMTreeElement extends WebInspector.TreeElem
 
     _attributeEditingCommitted(element, newText, oldText, attributeName, moveDirection)
     {
+        if (newText === oldText)
+            return;
+
         this._editing = false;
 
         var treeOutline = this.treeOutline;
Comment 3 Matt Baker 2017-02-11 01:58:05 PST
Created attachment 301249 [details]
Patch
Comment 4 Joseph Pecoraro 2017-02-12 22:27:38 PST
Comment on attachment 301249 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=301249&action=review

> Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js:963
> +        if (!moveDirection && newText === oldText)

What about all of the other functions with moveDirection? _tagNameEditingCommitted and _attributeNumberEditingCommitted?
Comment 5 Matt Baker 2017-02-13 00:44:11 PST
Comment on attachment 301249 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=301249&action=review

>> Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js:963
>> +        if (!moveDirection && newText === oldText)
> 
> What about all of the other functions with moveDirection? _tagNameEditingCommitted and _attributeNumberEditingCommitted?

I didn't notice these. However, it looks like _tagNameEditingCommitted handles moveDirection in `cancel()`, and _attributeNumberEditingCommitted ignores the parameter.
Comment 6 WebKit Commit Bot 2017-02-13 11:16:23 PST
Comment on attachment 301249 [details]
Patch

Clearing flags on attachment: 301249

Committed r212236: <http://trac.webkit.org/changeset/212236>
Comment 7 WebKit Commit Bot 2017-02-13 11:16:27 PST
All reviewed patches have been landed.  Closing bug.