Repository navigation
GH Issue 1793: Keep EHR forms from overwriting fields being edited - #1243
Conversation
|
Working through some Claude feedback |
|
@labkey-tchad , @labkey-martyp or @labkey-bpatel: I'm worried that tracking the field list, like this does, is a fragile approach. If the root issue is composite fields (which I can believe), would a more reliable solution to improve the "hasFocus" check by querying children and checking whether hasFocus=true on any of them? That avoids needing to maintain this list, which could get stale for unanticipated reasons. Also, does pendingFieldIds ever get cleared? I did not test, but I think something vaguely like this pseudocode would do it: |
…lear flags on bind and unbind
|
Claude response:
|
|
Whether Claude thinks so or not, my experience still says that all these extra listeners give you greater chance for some scenario not working the way you expect. The underlying problem does not sound especially complicated: composite fields dont correctly report hasFocus. If the child query works, it's a more "Ext-y" solution. Even if Ext is ancient now, all this code is operating within Ext's listeners and events. Making our own system over this isnt automatically a good idea, Claude approval or not. |
|
I think there are two separate issues here:
testAutomation#3286 already fixes 2 on the test side by typing over Ext4 fields instead of clearing them, so I'm wondering whether the extra bookkeeping is still needed. Could we drop it, keep only the focus fix, and rerun TNPRC_EHRTest and TNPRC_RequestsTest on Firefox 153? If they do not pass, we'll have a concrete failure that justifies it. @labkey-tchad - thoughts? |
I tend to agree with point 1. On point 2: I still dont have the full context, but Binal's post suggests the driver of this change is to address "super-human" interaction driven by selenium, rather than a condition that normal human interaction has been known to create. If true, I would urge caution about unintended consequences, and continue to make the point that adding a new custom scheme to cache changes (pendingFieldIds) is opening up potential issue that doesnt seem to be needed. I am also interested to see how LabKey/LabDevKitModules#329 interacts with this. The concept behind the LDK PR does make sense, and would probably issue redundant events and buffering as they bubble up that would slow things down a little. These are certainly the most common composite (though not the only composite) field. |
That is correct. Thank you. |
| return true; | ||
|
|
||
| var el = field.getEl(); | ||
| return !!el && el.dom.contains(document.activeElement); |
There was a problem hiding this comment.
This is probably a fine way to do this check. I cant think of any reason Ext would render elements that doesnt conform to this expectation, but I also havent tested anything.
I think the following would work and is more Ext-y, but I dont feel strongly enough to hold up this PR on it:
if (field.hasFocus || field.down('[hasFocus]')?.length)
Rationale
Stop EHR data entry forms from overwriting a value the user is still entering (GH Issue 1793). A form update replaced partly typed dates and times in date-time fields, because the field counted as unfocused while focus was in its date or time box. Firefox 153 makes this frequent enough to fail TNPRC_EHRTest.
Related Pull Requests
Changes