Cursor appears behind "markText" area with a background color

I am using “markText” to highlight certain parts of the editor content. The “markText” is assigning a class with a background-color. When I move the cursor to the highlighted area, it disappears. The cursor appears as expected in a non-highlighted area. How can I get the cursor to be in front?

This is a known behavior. The solution is to upgrade to the current version, which should solve the problem for cursors. To also solve it for selected text, load and enable the mark-selection addon, which will ensure that the background of the marked spans is disabled for selected text.