diff --git a/buffit/index.html b/buffit/index.html index 8d76b26..90754af 100644 --- a/buffit/index.html +++ b/buffit/index.html @@ -816,7 +816,7 @@ throw new Error(data.error || 'Failed to load channels'); } - const allChannels = data.channels || []; + allChannels = data.channels || []; renderChannels(allChannels); accountLabel.textContent = 'Connected ยท ' + allChannels.length + ' channel' + (allChannels.length === 1 ? '' : 's'); } catch (e) { @@ -935,22 +935,39 @@ // ---------- emoji picker ---------- emojiBtn.addEventListener('click', () => { - const input = document.createElement('input'); - input.type = 'text'; - if (input.showPicker) { - input.addEventListener('input', (e) => { - postText.value += e.target.value; + // Try to use native emoji picker via hidden input + const picker = document.createElement('input'); + picker.type = 'text'; + picker.setAttribute('inputmode', 'emoji'); + picker.style.position = 'fixed'; + picker.style.opacity = '0'; + picker.style.pointerEvents = 'none'; + document.body.appendChild(picker); + + picker.addEventListener('input', (e) => { + if (e.data) { + postText.value += e.data; updateCharCount(); updateSendState(); - }, { once: true }); - input.showPicker(); - } else { - // Fallback: insert a smile emoji if showPicker is not supported - postText.value += '๐Ÿ˜Š'; - updateCharCount(); - updateSendState(); + } + document.body.removeChild(picker); postText.focus(); - } + }, { once: true }); + + setTimeout(() => { + picker.focus(); + if (picker.showPicker) { + try { + picker.showPicker(); + } catch (e) { + document.body.removeChild(picker); + postText.focus(); + } + } else { + document.body.removeChild(picker); + postText.focus(); + } + }, 0); }); mediaInput.addEventListener('change', () => {