pkabirrvelixo's avatar
pkabirrvelixo
Iron Contributor
Jan 23, 2025
Status:
New

Undo stack shouldn't get cleared when you invoke Office.ribbon.requestUpdate

We discovered that invoking Office.ribbon.requestUpdate to set visibility to a contextual tab unnecessarily clears the Undo stack.

Please lift this limitation if possible. Our customers complained about this issue, which does not exist on the legacy COM-based product.

Consider the following ScriptLab snippet: https://gist.github.com/wh1t3cAt1k/c1e74f7de3a447a8018549ffee177152

Steps to reproduce:

Part 1:

  • Create a workbook with two worksheets, Sheet1 and Sheet2
  • On Sheet1, enter "foo" in A1 and enter "bar" in A2.
  • Activate Sheet2
  • Press Undo
  • Validate that Excel switched back to Sheet1 and the "bar" value disappeared

Part 2:

  • Register the ScriptLab snippet above ("Run in this tab") and press the "Register ribbon and worksheet change listener" button in the side panel to invoke requestCreateControls and register the worksheet change listener.
  • On Sheet1, enter "foo" in A1 and enter "bar" in A2.
  • Activate Sheet2
  • Limitation: Undo is not available anymore

In this scenario, we performed a harmless operation that simply made a ribbon tab visible. The customers do not expect the Undo stack to be cleared in this scenario.

Note: the Undo stack gets cleared regardless if there is any effective change to the ribbon item visibility/enabled state. Simply calling the API seems to clear the stack.

No CommentsBe the first to comment