Hm, I just noticed that this only manifest on my Realm world. On singleplayer world, the search is working normally. Then, if I exit that world without quitting the program/client, and enter my Realm world again, recipe book searching works again as normal. It's just that when I start the Forge client and immediately enter a Realm world that recipe searching does not work.
I just installed Forge (1.12-forge1.12-14.21.1.2387) and Optifine on top, and everything works fine for me, except that when crafting, I can't seem to search anything (see screenshot)!
I'm sure it's not the resource pack that I use, because when I quit and used vanilla launcher, recipe book searching works as normal