Undo/Redo on Edit menu - anything special about these?

I’m using Quill to implement a rich text editor inside an HTMLViewer. This is under OS X Mavericks and using 2017R2.1.

Quill implements an undo/redo history stack with undo/redo methods and I found that cmd-Z and cmd-shift-Z did undo/redo without my needing to add any code or menu items at all. At that point I had, in my app, no menu items for undo/redo, so I added them along with the shortcuts, and extra buttons on the Quill toolbar for undo/redo.

The shortcuts and buttons work all the time; the difficulty is that the undo/redo menu items are being enabled/disabled a lot of the time, and not, as far as I know, by me. If disabled, of course, they don’t work. Is there any reason that this should be happening?

The Undo/Redo menu items reflect the status of the current control with focus… .especially TextField/TextArea which have a single level Undo ability built in.

under macOS you can tell if a control “can undo” with

Declare Function undoManager Lib "Cocoa" selector "undoManager" (obj_id As Integer) As Ptr 
Dim pnt1 As Ptr = undoManager(Self.Handle) 
Declare Function canUndo Lib "Cocoa" selector "canUndo" (receiver As Ptr) As Boolean 

In one of my projects I need UNDO for a custom control so I have the above code and

If (Me.Focus IsA TextField Or Me.focus IsA TextArea) Then 
End If

Even if I click inside the HTMLViewer, those two items remain disabled (the UNDO stack is inside the HTMLViewer and is managed by Quill itself in javascript).