I'm facing an issue with a web interface I am designing for configuring remotes to control ESP32 functions. The problem seems to be related to the Javascript part of the interface, as the code on the ESP32 is working fine. Here's how it works: the interface has tabs where you can select different options by clicking on the menu items which then show or hide corresponding dividers.
There is a specific tab for remote configuration. Upon loading the page, a websocket command is sent to the controller to request the remote configuration data. Once the data is received, my Javascript inserts it into the divider as an HTML table list showing the paired remotes along with device information and buttons to edit or delete each one, as well as a back button.
Currently, the delete functionality is not implemented as I want to focus on getting everything else working smoothly first.
When clicking the edit button, a command is passed to the controller, which then loads a new table with editable data and a list of buttons associated with that particular remote.
The list of buttons also have edit and delete functionalities similar to the above, along with a back button.
The back button within the 'edit' function is causing me trouble. After navigating through editing a remote, then a button, and trying to go back, it seems to send an unnecessary edit button command.
The real issue lies in the flow of commands being sent when using the edit and back buttons, especially when multiple levels deep into editing remotes and buttons. It should not trigger an unnecessary edit button command.
To reproduce this problem without access to the controller, I have provided a link to a JSFiddle example below. I have also added alert messages to indicate what is happening at each step.
Any assistance in resolving this issue would be highly appreciated.
Link to JSFiddle example: https://jsfiddle.net/kb1sph/37epovwg/
My code is too long to include here, but I needed a snippet to add the JSFiddle link, so here's a placeholder snippet.