It's not a hard legal requirement yet. The Legal Deposit Libraries Act 2003 introduced a framework in which the Secretary of State may make regulations for the deposit of non-print works. No such secondary legislation has been passed yet, to the best of my knowledge.
Pending the implementation of formal regulations, the British Library is
keen to encourage voluntary deposit of online or “pure electronic” items, though.