Grid confirming a value whit the Enter key doesn't read the state of a flag

Hello,
I need to monitor the value of a Grid cell, so setted a flag that changes status if the value doesn’t respect a rule. I adapted a script like this:
https://snippet.dhtmlx.com/nwlsqoid
The issue is this: if you change the value of “average_rating” and it is greater than the old value, triggers an alert. If you confirm the new (greater) value with clicking the mouse outside the cell, all is ok and the alert pops out. If you use the Enter key, this doesn’t happen.
Can you help me? Thanks
using 9.3.0 suite