# CodeMirror: Search/Replace Demo exhibits problem seen on Wikipedia

**URL:** https://discuss.codemirror.net/t/codemirror-search-replace-demo-exhibits-problem-seen-on-wikipedia/9914
**Category:** v5
**Created:** [October 18, 2026, 1:14pm UTC](https://discuss.codemirror.net/t/codemirror-search-replace-demo-exhibits-problem-seen-on-wikipedia/9914 "2026-10-18T13:14:15Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![johnjbarton](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/johnjbarton/32/5567_2.png) [@johnjbarton](https://discuss.codemirror.net/u/johnjbarton)
#### Post date: [October 18, 2026, 1:14pm UTC](https://discuss.codemirror.net/t/codemirror-search-replace-demo-exhibits-problem-seen-on-wikipedia/9914/1 "2026-10-18T13:14:15Z")

</div>

Hi. I have encountered some bugs with the Wikipedia (via Mediawiki) embedding of codemirror (accessed by Edit Source and selecting Syntax option). One of the bugs is also present in the search and replace demo:

1. Open the demo [CodeMirror: Search/Replace Demo](https://codemirror.net/5/demo/search.html)
2. Click into the editor to focus
3. Alt-F to get a persistent search dialog
4. enter “dl” to try to find the dl at the end of the doc: works
5. enter “Enter” key to try to find the dl at the beginning of the doc: fail.

The fail case finds the dl it it is underneath the search dialog. In the Demo you can kinda see both the dialog and the dl. In the equivalent case on wikipedia, the find hit is hidden. ([⚓ T441556 Codemirror on MacBook fails to position content on Find hits](https://phabricator.wikimedia.org/T441556))

I assume that a more complete implementation than the Demo does not have this problem, but anyone knows what makes the completion work perhaps I can relay the info to MediaWiki developers.

Thanks

jjb

> **[CodeMirror: Search/Replace Demo](https://codemirror.net/5/demo/search.html)**

---

<div class="post-metadata">

### Author: ![marijn](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/marijn/32/136_2.png) [@marijn](https://discuss.codemirror.net/u/marijn)
#### Post date: [October 18, 2026, 1:17pm UTC](https://discuss.codemirror.net/t/codemirror-search-replace-demo-exhibits-problem-seen-on-wikipedia/9914/2 "2026-10-18T13:17:40Z")

</div>

Version 6 has a much better implementation of the search panel. It’s been stable for over 4 years, so I’d say the way forward for any project still using 5.x but running into issues with it would be to upgrade.

---

<div class="post-metadata">

### Author: ![johnjbarton](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/johnjbarton/32/5567_2.png) [@johnjbarton](https://discuss.codemirror.net/u/johnjbarton)
#### Post date: [October 20, 2026, 3:46am UTC](https://discuss.codemirror.net/t/codemirror-search-replace-demo-exhibits-problem-seen-on-wikipedia/9914/3 "2026-10-20T03:46:25Z")

</div>

Wikipedia uses v6 as of 21 April 2026 according to [Extension:CodeMirror - MediaWiki](https://www.mediawiki.org/wiki/Extension:CodeMirror).

The v6 demo [Try CodeMirror](https://codemirror.net/try/#example=Minimal%20editor) places the Find/Replace dialog at the bottom. Wikipedia places this dialog at the top (like the cm v5 demo). The first bug I am trying to narrow down is a failure to scroll to match because the match is underneath the dialog.

Two matches in the doc appear at the very top and somewhere down lower. The first find works because the content is displayed below the dialog. The second find works. The third find will cycle back to the first match, but the dialog now covers the match and scrolling it in to view does not happen. If that makes any sense.

As far as I can tell so far they use your scrollToMatch() and EditorView.scrollIntoView(). But something they supply is off. I need to find where their embedding code is I guess.
