Bug 192871 - Web Inspector: Elements tab: arrow key after undoing a DOM node delete selects the wrong element
Summary: Web Inspector: Elements tab: arrow key after undoing a DOM node delete select...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P3 Normal
Assignee: Matt Baker
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-12-19 12:32 PST by Matt Baker
Modified: 2018-12-19 16:46 PST (History)
4 users (show)

See Also:


Attachments
Patch (1.81 KB, patch)
2018-12-19 13:50 PST, Matt Baker
no flags Details | Formatted Diff | Diff
Patch for landing (2.61 KB, patch)
2018-12-19 16:20 PST, Matt Baker
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Baker 2018-12-19 12:32:34 PST
Summary:
Arrow key after undoing a DOM node delete selects the wrong element.

Test Page:
<p id="a"></p>
<p id="b"></p>
<p id="c"></p>

Steps to Reproduce:
1. Inspect test page
2. Elements tab > select DOM node for p#b
3. Press Delete
4. DOM node for p#c selected
5. Undo
6. DOM node for p#b restored
7. Press arrow key up

Actual:
  => DOM node for p#a selected

Expected:
  => DOM node for p#b selected
Comment 1 Radar WebKit Bug Importer 2018-12-19 12:33:00 PST
<rdar://problem/46849060>
Comment 2 Matt Baker 2018-12-19 13:50:31 PST
Created attachment 357716 [details]
Patch
Comment 3 Devin Rousso 2018-12-19 14:07:49 PST
Comment on attachment 357716 [details]
Patch

rs=me, nice catch :)

Is it possible for us to select the item before it's been inserted?  I'd assume not as the indexes would get all messed up.  If so, however, we may not want to move either value if the index is selected.
Comment 4 Matt Baker 2018-12-19 16:19:52 PST
(In reply to Devin Rousso from comment #3)
> Comment on attachment 357716 [details]
> Patch
> 
> rs=me, nice catch :)
> 
> Is it possible for us to select the item before it's been inserted?  I'd
> assume not as the indexes would get all messed up.  If so, however, we may
> not want to move either value if the index is selected.

`TreeElement.prototype.select` will return if it hasn't been attached, so it looks like we shouldn't be able to get into this state. I'll add an assert since I can't be completely sure.
Comment 5 Matt Baker 2018-12-19 16:20:00 PST
Created attachment 357748 [details]
Patch for landing
Comment 6 WebKit Commit Bot 2018-12-19 16:46:21 PST
Comment on attachment 357748 [details]
Patch for landing

Clearing flags on attachment: 357748

Committed r239405: <https://trac.webkit.org/changeset/239405>
Comment 7 WebKit Commit Bot 2018-12-19 16:46:22 PST
All reviewed patches have been landed.  Closing bug.