Skip to content

Commit

Permalink
fixes #2993, fixes #1759 (#3009)
Browse files Browse the repository at this point in the history
  • Loading branch information
SteffenDE authored Jan 15, 2024
1 parent fb29340 commit cdb4497
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions assets/js/phoenix_live_view/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -753,12 +753,13 @@ export default class View {

DOM.all(document, `[${PHX_REF_SRC}="${this.id}"][${PHX_REF}="${ref}"]`, el => {
let disabledVal = el.getAttribute(PHX_DISABLED)
let readOnlyVal = el.getAttribute(PHX_READONLY)
// remove refs
el.removeAttribute(PHX_REF)
el.removeAttribute(PHX_REF_SRC)
// restore inputs
if(el.getAttribute(PHX_READONLY) !== null){
el.readOnly = false
if(readOnlyVal !== null){
el.readOnly = readOnlyVal === "true" ? true : false
el.removeAttribute(PHX_READONLY)
}
if(disabledVal !== null){
Expand Down Expand Up @@ -798,7 +799,8 @@ export default class View {
el.setAttribute(PHX_DISABLE_WITH_RESTORE, el.innerText)
}
if(disableText !== ""){ el.innerText = disableText }
el.setAttribute(PHX_DISABLED, el.disabled)
// PHX_DISABLED could have already been set in disableForm
el.setAttribute(PHX_DISABLED, el.getAttribute(PHX_DISABLED) || el.disabled)
el.setAttribute("disabled", "")
}
})
Expand Down

0 comments on commit cdb4497

Please sign in to comment.