@@ -115,6 +115,42 @@ describe("FileExplorerPane", () => {
115115 expect ( localStorage . getItem ( STORAGE_KEY ) ) . toBe ( "160" ) ;
116116 } ) ;
117117
118+ it ( "keeps keyboard and pointer resizing usable when browser storage rejects writes" , async ( ) => {
119+ using _storage = storedWidth ( 256 ) ;
120+ await using screen = await render ( < PreviewRow width = { 600 } /> ) ;
121+ const write = Storage . prototype . setItem ;
122+ using _write = vi . spyOn ( Storage . prototype , "setItem" ) . mockImplementation ( function (
123+ this : Storage ,
124+ key ,
125+ value ,
126+ ) {
127+ if ( key === STORAGE_KEY ) throw new DOMException ( "Storage is full" , "QuotaExceededError" ) ;
128+ write . call ( this , key , value ) ;
129+ } ) ;
130+ using errors = vi . spyOn ( console , "error" ) . mockImplementation ( ( ) => { } ) ;
131+ // Synthetic pointer ids are not active browser pointers.
132+ using _capture = vi
133+ . spyOn ( HTMLElement . prototype , "setPointerCapture" )
134+ . mockImplementation ( ( ) => { } ) ;
135+ const explorer = screen . getByRole ( "complementary" , { name : "File explorer" } ) ;
136+ const handle = screen . getByRole ( "separator" , { name : "Resize file explorer" } ) ;
137+
138+ await userEvent . tab ( ) ;
139+ await userEvent . keyboard ( "{ArrowLeft}" ) ;
140+ await expectWidth ( explorer , 272 ) ;
141+ await expect . element ( handle ) . toHaveAttribute ( "aria-valuenow" , "272" ) ;
142+ expect ( localStorage . getItem ( STORAGE_KEY ) ) . toBe ( "256" ) ;
143+
144+ drag ( handle . element ( ) as HTMLElement , - 40 ) ;
145+ await expectWidth ( explorer , 312 ) ;
146+ await expect . element ( handle ) . toHaveAttribute ( "aria-valuenow" , "312" ) ;
147+ await screen . rerender ( < PreviewRow /> ) ;
148+ await expectWidth ( explorer , 312 ) ;
149+ expect ( localStorage . getItem ( STORAGE_KEY ) ) . toBe ( "256" ) ;
150+ expect ( errors ) . toHaveBeenCalledTimes ( 2 ) ;
151+ expect ( errors ) . toHaveBeenCalledWith ( "Could not persist panel width." , expect . any ( Error ) ) ;
152+ } ) ;
153+
118154 it ( "cleans up an active drag when the explorer is hidden" , async ( ) => {
119155 using _storage = storedWidth ( 256 ) ;
120156 await using screen = await render ( < PreviewRow /> ) ;
0 commit comments